From 00a5fbe44ab301784a1ba0b3cbfb8ae7589294d2 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Mon, 12 Oct 2026 09:59:17 +0000 Subject: [PATCH 1/3] Configurations: 'specification/advisor/resource-manager/Microsoft.Advisor/Advisor/tspconfig.yaml', and CommitSHA: '2f40414843c3098af00f7a2773c139d67363ce75' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6944486 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../CHANGELOG.md | 224 ++- .../azure-resourcemanager-advisor/README.md | 8 +- .../azure-resourcemanager-advisor/SAMPLE.md | 530 +++++- .../azure-resourcemanager-advisor/pom.xml | 8 +- .../advisor/AdvisorManager.java | 165 +- .../fluent/AdvisorManagementClient.java | 86 +- .../advisor/fluent/AdvisorScoresClient.java | 64 + .../advisor/fluent/AssessmentTypesClient.java | 46 + .../advisor/fluent/AssessmentsClient.java | 118 ++ .../advisor/fluent/ConfigurationsClient.java | 10 +- .../advisor/fluent/OperationsClient.java | 10 +- .../fluent/RecommendationMetadatasClient.java | 18 +- .../advisor/fluent/RecommendationsClient.java | 248 ++- .../fluent/ResiliencyReviewsClient.java | 84 + .../fluent/ResourceProvidersClient.java | 42 + .../advisor/fluent/SuppressionsClient.java | 24 +- .../advisor/fluent/WorkloadsClient.java | 46 + .../models/AdvisorScoreEntityInner.java | 164 ++ .../models/AdvisorScoreEntityProperties.java | 95 + .../fluent/models/AssessmentResultInner.java | 275 +++ .../models/AssessmentResultProperties.java | 253 +++ .../models/AssessmentTypeResultInner.java | 142 ++ .../fluent/models/ConfigDataInner.java | 56 +- .../fluent/models/ConfigDataProperties.java | 45 +- .../fluent/models/MetadataEntityInner.java | 162 +- .../models/MetadataEntityProperties.java | 63 +- .../fluent/models/OperationEntityInner.java | 41 +- .../models/PredictionRequestProperties.java | 121 ++ .../models/PredictionResponseInner.java | 143 ++ .../models/PredictionResponseProperties.java | 192 +++ .../models/RecommendationProperties.java | 553 +++--- .../fluent/models/ResiliencyReviewInner.java | 198 +++ .../models/ResiliencyReviewProperties.java | 155 ++ .../ResourceRecommendationBaseInner.java | 398 ++--- .../models/SuppressionContractInner.java | 38 +- .../fluent/models/SuppressionProperties.java | 22 +- .../fluent/models/WorkloadResultInner.java | 125 ++ .../advisor/fluent/models/package-info.java | 6 +- .../advisor/fluent/package-info.java | 6 +- .../AdvisorManagementClientBuilder.java | 28 +- .../AdvisorManagementClientImpl.java | 218 ++- .../AdvisorScoreEntityImpl.java | 62 + .../AdvisorScoresClientImpl.java | 250 +++ .../implementation/AdvisorScoresImpl.java | 62 + .../implementation/AssessmentResultImpl.java | 159 ++ .../AssessmentTypeResultImpl.java | 48 + .../AssessmentTypesClientImpl.java | 279 +++ .../implementation/AssessmentTypesImpl.java | 45 + .../implementation/AssessmentsClientImpl.java | 525 ++++++ .../implementation/AssessmentsImpl.java | 110 ++ .../implementation/ConfigDataImpl.java | 17 +- .../ConfigurationsClientImpl.java | 489 +++--- .../implementation/ConfigurationsImpl.java | 10 +- .../implementation/MetadataEntityImpl.java | 11 +- .../implementation/OperationEntityImpl.java | 2 +- .../implementation/OperationsClientImpl.java | 143 +- .../implementation/OperationsImpl.java | 2 +- .../PredictionResponseImpl.java | 62 + .../RecommendationMetadatasClientImpl.java | 265 ++- .../RecommendationMetadatasImpl.java | 14 +- .../RecommendationsClientImpl.java | 1533 +++++++++++++---- .../implementation/RecommendationsImpl.java | 121 +- .../implementation/ResiliencyReviewImpl.java | 70 + .../ResiliencyReviewsClientImpl.java | 427 +++++ .../implementation/ResiliencyReviewsImpl.java | 62 + .../implementation/ResourceManagerUtils.java | 2 +- .../ResourceProvidersClientImpl.java | 142 ++ .../implementation/ResourceProvidersImpl.java | 52 + .../ResourceRecommendationBaseImpl.java | 114 +- .../SuppressionContractImpl.java | 11 +- .../SuppressionsClientImpl.java | 458 ++--- .../implementation/SuppressionsImpl.java | 10 +- .../implementation/WorkloadResultImpl.java | 44 + .../implementation/WorkloadsClientImpl.java | 275 +++ .../advisor/implementation/WorkloadsImpl.java | 44 + .../models/AdvisorScoreResponse.java | 78 + .../models/AssessmentListResult.java | 96 ++ .../models/AssessmentTypeListResult.java | 96 ++ .../models/ConfigurationListResult.java | 54 +- .../models/MetadataEntityListResult.java | 54 +- .../models/OperationEntityListResult.java | 72 +- .../models/ResiliencyReviewCollection.java | 96 ++ .../ResourceRecommendationBaseListResult.java | 72 +- .../models/SuppressionContractListResult.java | 72 +- .../models/WorkloadListResult.java | 96 ++ .../advisor/implementation/package-info.java | 6 +- .../advisor/models/AdvisorScoreEntity.java | 63 + .../advisor/models/AdvisorScores.java | 57 + .../advisor/models/Aggregated.java | 56 + .../advisor/models/AssessmentResult.java | 283 +++ .../advisor/models/AssessmentTypeResult.java | 54 + .../advisor/models/AssessmentTypes.java | 41 + .../advisor/models/Assessments.java | 134 ++ .../advisor/models/Category.java | 4 +- .../advisor/models/ConfigData.java | 37 +- .../advisor/models/ConfigurationName.java | 2 +- .../advisor/models/Configurations.java | 10 +- .../advisor/models/Control.java | 86 + .../advisor/models/CpuThreshold.java | 2 +- .../advisor/models/DigestConfig.java | 10 +- .../advisor/models/DigestConfigState.java | 2 +- .../advisor/models/DurationModel.java | 72 + .../advisor/models/Impact.java | 2 +- .../advisor/models/MetadataEntity.java | 20 +- .../models/MetadataSupportedValueDetail.java | 38 +- .../advisor/models/OperationDisplayInfo.java | 60 +- .../advisor/models/OperationEntity.java | 2 +- .../advisor/models/Operations.java | 10 +- .../advisor/models/PredictionRequest.java | 122 ++ .../advisor/models/PredictionResponse.java | 70 + .../advisor/models/PredictionType.java | 46 + .../advisor/models/Priority.java | 66 + .../models/RecommendationDismissReason.java | 81 + .../models/RecommendationListMode.java | 51 + .../models/RecommendationMetadatas.java | 18 +- .../models/RecommendationPatchPayload.java | 86 + ...ommendationPropertiesResourceWorkload.java | 93 + .../RecommendationPropertiesReview.java | 92 + .../RecommendationStatePropertiesPayload.java | 155 ++ .../advisor/models/RecommendationStatus.java | 61 + .../advisor/models/Recommendations.java | 233 ++- .../RecommendationsGenerateHeaders.java | 49 +- .../RecommendationsGenerateResponse.java | 2 +- ...commendationsGetGenerateStatusHeaders.java | 44 + ...ommendationsGetGenerateStatusResponse.java | 29 + .../advisor/models/ResiliencyReview.java | 90 + .../advisor/models/ResiliencyReviews.java | 77 + .../advisor/models/ResourceMetadata.java | 87 +- .../advisor/models/ResourceProviders.java | 36 + .../models/ResourceRecommendationBase.java | 156 +- .../models/ResourceRecommendationSavings.java | 170 ++ .../ResourceRecommendationSavingsDetails.java | 167 ++ .../advisor/models/ReviewStatus.java | 56 + .../resourcemanager/advisor/models/Risk.java | 56 + .../advisor/models/Scenario.java | 4 +- .../advisor/models/ScoreEntity.java | 160 ++ .../advisor/models/ShortDescription.java | 38 +- .../advisor/models/SuppressionContract.java | 19 +- .../advisor/models/Suppressions.java | 18 +- .../advisor/models/TimeSeriesEntity.java | 94 + .../TrackedRecommendationProperties.java | 75 + .../advisor/models/WorkloadResult.java | 47 + .../advisor/models/Workloads.java | 41 + .../advisor/models/package-info.java | 6 +- .../resourcemanager/advisor/package-info.java | 6 +- .../src/main/java/module-info.java | 3 +- ...zure-resourcemanager-advisor_metadata.json | 1 + .../proxy-config.json | 2 +- .../azure-resourcemanager-advisor.properties | 1 + .../generated/AdvisorScoresGetSamples.java | 22 + .../generated/AdvisorScoresListSamples.java | 22 + .../generated/AssessmentTypesListSamples.java | 22 + .../generated/AssessmentsDeleteSamples.java | 22 + .../generated/AssessmentsGetSamples.java | 22 + .../generated/AssessmentsListSamples.java | 22 + .../generated/AssessmentsPutSamples.java | 27 + ...gurationsCreateInResourceGroupSamples.java | 9 +- ...igurationsCreateInSubscriptionSamples.java | 9 +- ...figurationsListByResourceGroupSamples.java | 5 +- .../generated/ConfigurationsListSamples.java | 5 +- .../generated/OperationsListSamples.java | 9 +- .../RecommendationMetadataGetSamples.java | 5 +- .../RecommendationMetadataListSamples.java | 8 +- .../RecommendationsGenerateSamples.java | 5 +- ...commendationsGetByServiceGroupSamples.java | 24 + ...commendationsGetGenerateStatusSamples.java | 10 +- .../generated/RecommendationsGetSamples.java | 30 +- ...ommendationsListByServiceGroupSamples.java | 26 + .../RecommendationsListByTenantSamples.java | 25 + .../generated/RecommendationsListSamples.java | 14 +- ...mendationsUpdateByServiceGroupSamples.java | 36 + .../RecommendationsUpdateSamples.java | 34 + .../ResiliencyReviewsGetSamples.java | 23 + .../ResiliencyReviewsListSamples.java | 22 + .../ResourceProviderPredictSamples.java | 32 + .../generated/SuppressionsCreateSamples.java | 10 +- .../generated/SuppressionsDeleteSamples.java | 7 +- .../generated/SuppressionsGetSamples.java | 8 +- .../generated/SuppressionsListSamples.java | 5 +- .../generated/WorkloadsListSamples.java | 22 + .../AdvisorScoreEntityInnerTests.java | 32 + .../AdvisorScoreEntityPropertiesTests.java | 32 + .../generated/AdvisorScoreResponseTests.java | 25 + ...AdvisorScoresGetWithResponseMockTests.java | 44 + .../generated/AdvisorScoresListMockTests.java | 46 + .../generated/AssessmentListResultTests.java | 22 + .../generated/AssessmentResultInnerTests.java | 32 + .../AssessmentResultPropertiesTests.java | 31 + .../AssessmentTypeListResultTests.java | 24 + .../AssessmentTypeResultInnerTests.java | 23 + .../AssessmentTypesListMockTests.java | 42 + ...ssessmentsDeleteWithResponseMockTests.java | 33 + .../AssessmentsGetWithResponseMockTests.java | 40 + .../generated/AssessmentsListMockTests.java | 41 + .../AssessmentsPutWithResponseMockTests.java | 44 + .../generated/ConfigDataInnerTests.java | 63 +- .../generated/ConfigDataPropertiesTests.java | 82 +- .../ConfigurationListResultTests.java | 66 +- ...eInResourceGroupWithResponseMockTests.java | 39 +- ...teInSubscriptionWithResponseMockTests.java | 77 +- ...gurationsListByResourceGroupMockTests.java | 26 +- .../ConfigurationsListMockTests.java | 24 +- .../advisor/generated/DigestConfigTests.java | 40 +- .../generated/MetadataEntityInnerTests.java | 39 +- .../MetadataEntityListResultTests.java | 50 +- .../MetadataEntityPropertiesTests.java | 29 +- .../MetadataSupportedValueDetailTests.java | 18 +- .../generated/OperationDisplayInfoTests.java | 28 +- .../generated/OperationEntityInnerTests.java | 30 +- .../OperationEntityListResultTests.java | 54 +- .../generated/OperationsListMockTests.java | 18 +- .../PredictionRequestPropertiesTests.java | 31 + .../generated/PredictionRequestTests.java | 29 + .../PredictionResponseInnerTests.java | 29 + .../PredictionResponsePropertiesTests.java | 29 + ...tionMetadatasGetWithResponseMockTests.java | 24 +- .../RecommendationMetadatasListMockTests.java | 21 +- .../RecommendationPatchPayloadTests.java | 41 + ...dationPropertiesResourceWorkloadTests.java | 20 + .../RecommendationPropertiesReviewTests.java | 20 + .../RecommendationPropertiesTests.java | 129 +- ...mmendationStatePropertiesPayloadTests.java | 39 + ...ndationsGenerateWithResponseMockTests.java | 6 +- ...etByServiceGroupWithResponseMockTests.java | 79 + ...etGenerateStatusWithResponseMockTests.java | 11 +- ...commendationsGetWithResponseMockTests.java | 67 +- ...mendationsListByServiceGroupMockTests.java | 83 + .../RecommendationsListByTenantMockTests.java | 81 + .../RecommendationsListMockTests.java | 72 +- ...teByServiceGroupWithResponseMockTests.java | 87 + ...mendationsUpdateWithResponseMockTests.java | 87 + .../ResiliencyReviewCollectionTests.java | 19 + .../generated/ResiliencyReviewInnerTests.java | 17 + .../ResiliencyReviewPropertiesTests.java | 17 + ...liencyReviewsGetWithResponseMockTests.java | 36 + .../ResiliencyReviewsListMockTests.java | 37 + .../generated/ResourceMetadataTests.java | 40 +- ...ProvidersPredictWithResponseMockTests.java | 53 + .../ResourceRecommendationBaseInnerTests.java | 129 +- ...urceRecommendationBaseListResultTests.java | 169 +- ...urceRecommendationSavingsDetailsTests.java | 24 + .../ResourceRecommendationSavingsTests.java | 35 + .../advisor/generated/ScoreEntityTests.java | 23 + .../generated/ShortDescriptionTests.java | 18 +- .../SuppressionContractInnerTests.java | 15 +- .../SuppressionContractListResultTests.java | 26 +- .../generated/SuppressionPropertiesTests.java | 14 +- ...ppressionsCreateWithResponseMockTests.java | 20 +- ...ppressionsDeleteWithResponseMockTests.java | 8 +- .../SuppressionsGetWithResponseMockTests.java | 14 +- .../generated/SuppressionsListMockTests.java | 14 +- .../generated/TimeSeriesEntityTests.java | 25 + .../TrackedRecommendationPropertiesTests.java | 19 + .../generated/WorkloadListResultTests.java | 23 + .../generated/WorkloadResultInnerTests.java | 22 + .../generated/WorkloadsListMockTests.java | 41 + .../tsp-location.yaml | 4 + 257 files changed, 15611 insertions(+), 3667 deletions(-) create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorScoresClient.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentTypesClient.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentsClient.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ResiliencyReviewsClient.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ResourceProvidersClient.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/WorkloadsClient.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityInner.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityProperties.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultInner.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultProperties.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentTypeResultInner.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionRequestProperties.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseInner.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseProperties.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewInner.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewProperties.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/WorkloadResultInner.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoreEntityImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentResultImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypeResultImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesClientImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsClientImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/PredictionResponseImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsClientImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadResultImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsClientImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsImpl.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AdvisorScoreResponse.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentListResult.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentTypeListResult.java rename sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/{ => implementation}/models/ConfigurationListResult.java (65%) rename sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/{ => implementation}/models/MetadataEntityListResult.java (66%) rename sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/{ => implementation}/models/OperationEntityListResult.java (63%) create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResiliencyReviewCollection.java rename sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/{ => implementation}/models/ResourceRecommendationBaseListResult.java (64%) rename sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/{ => implementation}/models/SuppressionContractListResult.java (63%) create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/WorkloadListResult.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreEntity.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScores.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Aggregated.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentResult.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypeResult.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypes.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Assessments.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Control.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DurationModel.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionRequest.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionResponse.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionType.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Priority.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationDismissReason.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationListMode.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPatchPayload.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesResourceWorkload.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesReview.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatePropertiesPayload.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatus.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusHeaders.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusResponse.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReview.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReviews.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceProviders.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavings.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavingsDetails.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ReviewStatus.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Risk.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ScoreEntity.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/TimeSeriesEntity.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/TrackedRecommendationProperties.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/WorkloadResult.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Workloads.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/azure-resourcemanager-advisor_metadata.json create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/main/resources/azure-resourcemanager-advisor.properties create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresGetSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresListSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentTypesListSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsDeleteSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsGetSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsListSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsPutSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetByServiceGroupSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByServiceGroupSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByTenantSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateByServiceGroupSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsGetSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsListSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResourceProviderPredictSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/WorkloadsListSamples.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreEntityInnerTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreEntityPropertiesTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreResponseTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresGetWithResponseMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresListMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentListResultTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentResultInnerTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentResultPropertiesTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypeListResultTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypeResultInnerTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypesListMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsDeleteWithResponseMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsGetWithResponseMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsListMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsPutWithResponseMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionRequestPropertiesTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionRequestTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionResponseInnerTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionResponsePropertiesTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPatchPayloadTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesResourceWorkloadTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesReviewTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationStatePropertiesPayloadTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetByServiceGroupWithResponseMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByServiceGroupMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByTenantMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateByServiceGroupWithResponseMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateWithResponseMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewCollectionTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewInnerTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewPropertiesTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsGetWithResponseMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsListMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceProvidersPredictWithResponseMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationSavingsDetailsTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationSavingsTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ScoreEntityTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/TimeSeriesEntityTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/TrackedRecommendationPropertiesTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadListResultTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadResultInnerTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadsListMockTests.java create mode 100644 sdk/advisor/azure-resourcemanager-advisor/tsp-location.yaml diff --git a/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md b/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md index e37b3bf8a733a..660d88d1de2a9 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md +++ b/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md @@ -1,14 +1,230 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.1.0-beta.1 (2026-10-12) -### Features Added +- Azure Resource Manager Advisor client library for Java. This package contains Microsoft Azure SDK for Advisor Management SDK. REST APIs for Azure Advisor Resiliency Reviews. Package api-version 2026-08-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### `models.MetadataEntityListResult` was removed -### Other Changes +#### `models.SuppressionContractListResult` was removed + +#### `models.ConfigurationListResult` was removed + +#### `models.OperationEntityListResult` was removed + +#### `models.ResourceRecommendationBaseListResult` was removed + +#### `models.ResourceMetadata` was modified + +* `ResourceMetadata()` was changed to private access +* `withResourceId(java.lang.String)` was removed +* `validate()` was removed +* `withSource(java.lang.String)` was removed +* `withAction(java.util.Map)` was removed +* `withSingular(java.lang.String)` was removed +* `withPlural(java.lang.String)` was removed + +#### `models.MetadataSupportedValueDetail` was modified + +* `MetadataSupportedValueDetail()` was changed to private access +* `withId(java.lang.String)` was removed +* `validate()` was removed +* `withDisplayName(java.lang.String)` was removed + +#### `models.Recommendations` was modified + +* `list(java.lang.String,java.lang.Integer,java.lang.String,com.azure.core.util.Context)` was removed +* `getGenerateStatus(java.util.UUID)` was removed +* `getGenerateStatusWithResponse(java.util.UUID,com.azure.core.util.Context)` was removed + +#### `models.OperationDisplayInfo` was modified + +* `OperationDisplayInfo()` was changed to private access +* `validate()` was removed +* `withDescription(java.lang.String)` was removed +* `withResource(java.lang.String)` was removed +* `withOperation(java.lang.String)` was removed +* `withProvider(java.lang.String)` was removed + +#### `models.ShortDescription` was modified + +* `ShortDescription()` was changed to private access +* `validate()` was removed +* `withProblem(java.lang.String)` was removed +* `withSolution(java.lang.String)` was removed + +#### `models.SuppressionContract` was modified + +* `expirationTimestamp()` was removed + +#### `models.DigestConfig` was modified + +* `validate()` was removed + +#### `models.ResourceRecommendationBase` was modified + +* `suppressionIds()` was removed + +#### `models.RecommendationMetadatas` was modified + +* `list(com.azure.core.util.Context)` was removed + +#### `models.RecommendationsGenerateHeaders` was modified + +* `withRetryAfter(java.lang.String)` was removed +* `validate()` was removed +* `java.lang.String retryAfter()` -> `java.lang.Integer retryAfter()` +* `withLocation(java.lang.String)` was removed + +### Features Added + +* `models.Priority` was added + +* `models.Assessments` was added + +* `models.Risk` was added + +* `models.RecommendationPropertiesResourceWorkload` was added + +* `models.ReviewStatus` was added + +* `models.Workloads` was added + +* `models.ResourceRecommendationSavingsDetails` was added + +* `models.ResiliencyReview` was added + +* `models.RecommendationsGetGenerateStatusHeaders` was added + +* `models.AssessmentResult$Definition` was added + +* `models.AssessmentResult$Update` was added + +* `models.AdvisorScores` was added + +* `models.TrackedRecommendationProperties` was added + +* `models.RecommendationPatchPayload` was added + +* `models.PredictionType` was added + +* `models.RecommendationPropertiesReview` was added + +* `models.DurationModel` was added + +* `models.AdvisorScoreEntity` was added + +* `models.ScoreEntity` was added + +* `models.AssessmentResult$UpdateStages` was added + +* `models.PredictionRequest` was added + +* `models.RecommendationStatus` was added + +* `models.AssessmentTypes` was added + +* `models.AssessmentTypeResult` was added + +* `models.ResourceRecommendationSavings` was added + +* `models.TimeSeriesEntity` was added + +* `models.PredictionResponse` was added + +* `models.AssessmentResult` was added + +* `models.RecommendationsGetGenerateStatusResponse` was added + +* `models.RecommendationListMode` was added + +* `models.AssessmentResult$DefinitionStages` was added + +* `models.RecommendationStatePropertiesPayload` was added + +* `models.Control` was added + +* `models.RecommendationDismissReason` was added + +* `models.ResourceProviders` was added + +* `models.WorkloadResult` was added + +* `models.Aggregated` was added + +* `models.ResiliencyReviews` was added + +#### `models.ConfigData` was modified + +* `systemData()` was added +* `duration()` was added + +#### `models.Recommendations` was modified + +* `updateByServiceGroup(java.lang.String,java.lang.String,models.RecommendationPatchPayload)` was added +* `updateByServiceGroupWithResponse(java.lang.String,java.lang.String,models.RecommendationPatchPayload,com.azure.core.util.Context)` was added +* `list(java.lang.String,models.RecommendationListMode,java.lang.Integer,java.lang.String,com.azure.core.util.Context)` was added +* `getGenerateStatus(java.lang.String)` was added +* `listByServiceGroup(java.lang.String)` was added +* `update(java.lang.String,models.RecommendationPatchPayload)` was added +* `getByServiceGroup(java.lang.String,java.lang.String)` was added +* `listByTenant(java.lang.String)` was added +* `listByTenant(java.lang.String,java.lang.String,java.lang.Integer,java.lang.String,com.azure.core.util.Context)` was added +* `updateWithResponse(java.lang.String,models.RecommendationPatchPayload,com.azure.core.util.Context)` was added +* `getByServiceGroupWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `listByServiceGroup(java.lang.String,java.lang.String,models.RecommendationListMode,java.lang.Integer,java.lang.String,com.azure.core.util.Context)` was added +* `getGenerateStatusWithResponse(java.lang.String,com.azure.core.util.Context)` was added + +#### `models.ConfigData$Definition` was modified + +* `withDuration(models.DurationModel)` was added + +#### `AdvisorManager` was modified + +* `advisorScores()` was added +* `resiliencyReviews()` was added +* `workloads()` was added +* `assessments()` was added +* `resourceProviders()` was added +* `assessmentTypes()` was added + +#### `models.SuppressionContract` was modified + +* `expirationTimeStamp()` was added +* `systemData()` was added + +#### `models.ResourceRecommendationBase` was modified + +* `suppressionId()` was added +* `serviceGroupId()` was added +* `recommendationStatus()` was added +* `scoreChangedAt()` was added +* `resourceWorkload()` was added +* `risk()` was added +* `systemData()` was added +* `criticalityScore()` was added +* `completionType()` was added +* `notes()` was added +* `savings()` was added +* `createdTime()` was added +* `control()` was added +* `trackedProperties()` was added +* `criticality()` was added +* `lastRefreshed()` was added +* `recommendationDismissReason()` was added +* `postponedUntilDateTime()` was added +* `review()` was added +* `sourceSystem()` was added + +#### `models.RecommendationMetadatas` was modified + +* `list(java.lang.String,com.azure.core.util.Context)` was added + +#### `models.MetadataEntity` was modified + +* `systemData()` was added ## 1.0.0 (2024-12-23) diff --git a/sdk/advisor/azure-resourcemanager-advisor/README.md b/sdk/advisor/azure-resourcemanager-advisor/README.md index f9b6e70404cc3..c12f237b7ba6b 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/README.md +++ b/sdk/advisor/azure-resourcemanager-advisor/README.md @@ -2,7 +2,7 @@ Azure Resource Manager Advisor client library for Java. -This package contains Microsoft Azure SDK for Advisor Management SDK. REST APIs for Azure Advisor. Package tag package-2020-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +This package contains Microsoft Azure SDK for Advisor Management SDK. REST APIs for Azure Advisor Resiliency Reviews. Package api-version 2026-08-01-preview. 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 @@ -52,7 +52,7 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java -AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); @@ -60,7 +60,7 @@ AdvisorManager manager = AdvisorManager .authenticate(credential, profile); ``` -The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. See [Authentication][authenticate] for more options. @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [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/advisor/azure-resourcemanager-advisor/SAMPLE.md b/sdk/advisor/azure-resourcemanager-advisor/SAMPLE.md index 8b22552dc0333..ec0a88f5b0a23 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/SAMPLE.md +++ b/sdk/advisor/azure-resourcemanager-advisor/SAMPLE.md @@ -1,6 +1,22 @@ # Code snippets and samples +## AdvisorScores + +- [Get](#advisorscores_get) +- [List](#advisorscores_list) + +## AssessmentTypes + +- [List](#assessmenttypes_list) + +## Assessments + +- [Delete](#assessments_delete) +- [Get](#assessments_get) +- [List](#assessments_list) +- [Put](#assessments_put) + ## Configurations - [CreateInResourceGroup](#configurations_createinresourcegroup) @@ -21,8 +37,22 @@ - [Generate](#recommendations_generate) - [Get](#recommendations_get) +- [GetByServiceGroup](#recommendations_getbyservicegroup) - [GetGenerateStatus](#recommendations_getgeneratestatus) - [List](#recommendations_list) +- [ListByServiceGroup](#recommendations_listbyservicegroup) +- [ListByTenant](#recommendations_listbytenant) +- [Update](#recommendations_update) +- [UpdateByServiceGroup](#recommendations_updatebyservicegroup) + +## ResiliencyReviews + +- [Get](#resiliencyreviews_get) +- [List](#resiliencyreviews_list) + +## ResourceProvider + +- [Predict](#resourceprovider_predict) ## Suppressions @@ -30,6 +60,162 @@ - [Delete](#suppressions_delete) - [Get](#suppressions_get) - [List](#suppressions_list) + +## Workloads + +- [List](#workloads_list) +### AdvisorScores_Get + +```java +/** + * Samples for AdvisorScores Get. + */ +public final class AdvisorScoresGetSamples { + /* + * x-ms-original-file: 2026-08-01-preview/GetAdvisorScoreDetail.json + */ + /** + * Sample code: GetAdvisorScoreDetail. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getAdvisorScoreDetail(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.advisorScores().getWithResponse("Cost", com.azure.core.util.Context.NONE); + } +} +``` + +### AdvisorScores_List + +```java +/** + * Samples for AdvisorScores List. + */ +public final class AdvisorScoresListSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListAdvisorScore.json + */ + /** + * Sample code: ListAdvisorScore. + * + * @param manager Entry point to AdvisorManager. + */ + public static void listAdvisorScore(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.advisorScores().list(com.azure.core.util.Context.NONE); + } +} +``` + +### AssessmentTypes_List + +```java +/** + * Samples for AssessmentTypes List. + */ +public final class AssessmentTypesListSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListAssessmentTypes.json + */ + /** + * Sample code: GetAssessmentTypes. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getAssessmentTypes(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.assessmentTypes().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Assessments_Delete + +```java +/** + * Samples for Assessments Delete. + */ +public final class AssessmentsDeleteSamples { + /* + * x-ms-original-file: 2026-08-01-preview/DeleteAssessment.json + */ + /** + * Sample code: DeleteAssessment. + * + * @param manager Entry point to AdvisorManager. + */ + public static void deleteAssessment(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.assessments().deleteWithResponse("assessment1", com.azure.core.util.Context.NONE); + } +} +``` + +### Assessments_Get + +```java +/** + * Samples for Assessments Get. + */ +public final class AssessmentsGetSamples { + /* + * x-ms-original-file: 2026-08-01-preview/GetAssessment.json + */ + /** + * Sample code: GetAssessment. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getAssessment(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.assessments().getWithResponse("assessment1", com.azure.core.util.Context.NONE); + } +} +``` + +### Assessments_List + +```java +/** + * Samples for Assessments List. + */ +public final class AssessmentsListSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListAssessments.json + */ + /** + * Sample code: ListAssessments. + * + * @param manager Entry point to AdvisorManager. + */ + public static void listAssessments(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.assessments().list(null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Assessments_Put + +```java +/** + * Samples for Assessments Put. + */ +public final class AssessmentsPutSamples { + /* + * x-ms-original-file: 2026-08-01-preview/PutAssessment.json + */ + /** + * Sample code: PutAssessment. + * + * @param manager Entry point to AdvisorManager. + */ + public static void putAssessment(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.assessments() + .define("assessment1") + .withWorkloadId("f72b7134-800f-4f1b-a5bd-691e2140c7d5") + .withTypeId("23513bdb-e8a2-4f0b-8b6b-191ee1f52d34") + .withLocale("en-us") + .create(); + } +} +``` + ### Configurations_CreateInResourceGroup ```java @@ -38,6 +224,7 @@ import com.azure.resourcemanager.advisor.models.ConfigurationName; import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfig; import com.azure.resourcemanager.advisor.models.DigestConfigState; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.util.Arrays; /** @@ -45,8 +232,7 @@ import java.util.Arrays; */ public final class ConfigurationsCreateInResourceGroupSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/CreateConfiguration.json + * x-ms-original-file: 2026-08-01-preview/CreateConfiguration.json */ /** * Sample code: PutConfigurations. @@ -59,9 +245,10 @@ public final class ConfigurationsCreateInResourceGroupSamples { .withExistingResourceGroup("resourceGroup") .withExclude(true) .withLowCpuThreshold(CpuThreshold.FIVE) + .withDuration(DurationModel.SEVEN) .withDigests(Arrays.asList(new DigestConfig().withName("digestConfigName") .withActionGroupResourceId( - "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName") + "/subscriptions/58c3f667-7a62-4bfd-a658-846493e9a493/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName") .withFrequency(30) .withCategories(Arrays.asList(Category.HIGH_AVAILABILITY, Category.SECURITY, Category.PERFORMANCE, Category.COST, Category.OPERATIONAL_EXCELLENCE)) @@ -81,6 +268,7 @@ import com.azure.resourcemanager.advisor.models.ConfigurationName; import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfig; import com.azure.resourcemanager.advisor.models.DigestConfigState; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.util.Arrays; /** @@ -88,8 +276,7 @@ import java.util.Arrays; */ public final class ConfigurationsCreateInSubscriptionSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/CreateConfiguration.json + * x-ms-original-file: 2026-08-01-preview/CreateConfiguration_CreateInSubscription.json */ /** * Sample code: PutConfigurations. @@ -100,9 +287,10 @@ public final class ConfigurationsCreateInSubscriptionSamples { manager.configurations() .createInSubscriptionWithResponse(ConfigurationName.DEFAULT, new ConfigDataInner().withExclude(true) .withLowCpuThreshold(CpuThreshold.FIVE) + .withDuration(DurationModel.SEVEN) .withDigests(Arrays.asList(new DigestConfig().withName("digestConfigName") .withActionGroupResourceId( - "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName") + "/subscriptions/58c3f667-7a62-4bfd-a658-846493e9a493/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName") .withFrequency(30) .withCategories(Arrays.asList(Category.HIGH_AVAILABILITY, Category.SECURITY, Category.PERFORMANCE, Category.COST, Category.OPERATIONAL_EXCELLENCE)) @@ -121,8 +309,7 @@ public final class ConfigurationsCreateInSubscriptionSamples { */ public final class ConfigurationsListSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListConfigurations.json + * x-ms-original-file: 2026-08-01-preview/ListConfigurations_ListBySubscription.json */ /** * Sample code: GetConfigurations. @@ -143,8 +330,7 @@ public final class ConfigurationsListSamples { */ public final class ConfigurationsListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListConfigurations.json + * x-ms-original-file: 2026-08-01-preview/ListConfigurations.json */ /** * Sample code: GetConfigurations. @@ -165,15 +351,14 @@ public final class ConfigurationsListByResourceGroupSamples { */ public final class OperationsListSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListOperations.json + * x-ms-original-file: 2026-08-01-preview/OperationsList.json */ /** - * Sample code: ListRecommendations. + * Sample code: OperationsList. * * @param manager Entry point to AdvisorManager. */ - public static void listRecommendations(com.azure.resourcemanager.advisor.AdvisorManager manager) { + public static void operationsList(com.azure.resourcemanager.advisor.AdvisorManager manager) { manager.operations().list(com.azure.core.util.Context.NONE); } } @@ -187,8 +372,7 @@ public final class OperationsListSamples { */ public final class RecommendationMetadataGetSamples { /* - * x-ms-original-file: specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ - * GetRecommendationMetadataEntity.json + * x-ms-original-file: 2026-08-01-preview/GetRecommendationMetadataEntity.json */ /** * Sample code: GetMetadata. @@ -209,9 +393,7 @@ public final class RecommendationMetadataGetSamples { */ public final class RecommendationMetadataListSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListRecommendationMetadata. - * json + * x-ms-original-file: 2026-08-01-preview/ListRecommendationMetadata.json */ /** * Sample code: GetMetadata. @@ -219,7 +401,7 @@ public final class RecommendationMetadataListSamples { * @param manager Entry point to AdvisorManager. */ public static void getMetadata(com.azure.resourcemanager.advisor.AdvisorManager manager) { - manager.recommendationMetadatas().list(com.azure.core.util.Context.NONE); + manager.recommendationMetadatas().list(null, com.azure.core.util.Context.NONE); } } ``` @@ -232,8 +414,7 @@ public final class RecommendationMetadataListSamples { */ public final class RecommendationsGenerateSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GenerateRecommendations.json + * x-ms-original-file: 2026-08-01-preview/GenerateRecommendations.json */ /** * Sample code: GenerateRecommendations. @@ -254,32 +435,70 @@ public final class RecommendationsGenerateSamples { */ public final class RecommendationsGetSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetRecommendationDetail.json + * x-ms-original-file: 2026-08-01-preview/GetRecommendationDetailServiceGroupResourceUri.json */ /** - * Sample code: GetRecommendationDetail. + * Sample code: GetRecommendationDetailServiceGroupResourceUri. * * @param manager Entry point to AdvisorManager. */ - public static void getRecommendationDetail(com.azure.resourcemanager.advisor.AdvisorManager manager) { - manager.recommendations().getWithResponse("resourceUri", "recommendationId", com.azure.core.util.Context.NONE); + public static void + getRecommendationDetailServiceGroupResourceUri(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .getWithResponse("providers/microsoft.management/serviceGroup/serviceGroupXYZ", + "37c93209-4bfb-4f3b-8874-ccc718f7a467", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-08-01-preview/GetRecommendationDetailSubscriptionResourceUri.json + */ + /** + * Sample code: GetRecommendationDetailSubscriptionResourceUri. + * + * @param manager Entry point to AdvisorManager. + */ + public static void + getRecommendationDetailSubscriptionResourceUri(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .getWithResponse( + "subscriptions/a5481ee1-95df-47d0-85d4-dd3f0dfa19bc/resourceGroups/resourceGroup/providers/Microsoft.Compute/availabilitysets/armavset", + "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45", com.azure.core.util.Context.NONE); } } ``` -### Recommendations_GetGenerateStatus +### Recommendations_GetByServiceGroup ```java -import java.util.UUID; +/** + * Samples for Recommendations GetByServiceGroup. + */ +public final class RecommendationsGetByServiceGroupSamples { + /* + * x-ms-original-file: 2026-08-01-preview/GetRecommendationDetailByServiceGroup.json + */ + /** + * Sample code: GetRecommendationDetailByServiceGroup. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getRecommendationDetailByServiceGroup(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .getByServiceGroupWithResponse("serviceGroupXYZ", "37c93209-4bfb-4f3b-8874-ccc718f7a467", + com.azure.core.util.Context.NONE); + } +} +``` +### Recommendations_GetGenerateStatus + +```java /** * Samples for Recommendations GetGenerateStatus. */ public final class RecommendationsGetGenerateStatusSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/EmptyResponse.json + * x-ms-original-file: 2026-08-01-preview/EmptyResponse.json */ /** * Sample code: GetGenerateStatus. @@ -288,8 +507,7 @@ public final class RecommendationsGetGenerateStatusSamples { */ public static void getGenerateStatus(com.azure.resourcemanager.advisor.AdvisorManager manager) { manager.recommendations() - .getGenerateStatusWithResponse(UUID.fromString("00000000-0000-0000-0000-000000000000"), - com.azure.core.util.Context.NONE); + .getGenerateStatusWithResponse("123e4567-e89b-12d3-a456-426614174000", com.azure.core.util.Context.NONE); } } ``` @@ -297,21 +515,214 @@ public final class RecommendationsGetGenerateStatusSamples { ### Recommendations_List ```java +import com.azure.resourcemanager.advisor.models.RecommendationListMode; + /** * Samples for Recommendations List. */ public final class RecommendationsListSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListRecommendations.json + * x-ms-original-file: 2026-08-01-preview/ListRecommendationsSubscriptionResourceUri.json + */ + /** + * Sample code: ListRecommendationsSubscriptionResourceUri. + * + * @param manager Entry point to AdvisorManager. + */ + public static void + listRecommendationsSubscriptionResourceUri(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations().list(null, RecommendationListMode.ALL, 10, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Recommendations_ListByServiceGroup + +```java +import com.azure.resourcemanager.advisor.models.RecommendationListMode; + +/** + * Samples for Recommendations ListByServiceGroup. + */ +public final class RecommendationsListByServiceGroupSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListRecommendationsByServiceGroup.json + */ + /** + * Sample code: ListRecommendationsByServiceGroup. + * + * @param manager Entry point to AdvisorManager. + */ + public static void listRecommendationsByServiceGroup(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .listByServiceGroup("serviceGroupXYZ", null, RecommendationListMode.ALL, 10, null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Recommendations_ListByTenant + +```java +/** + * Samples for Recommendations ListByTenant. + */ +public final class RecommendationsListByTenantSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListRecommendationsServiceGroupResourceUri.json + */ + /** + * Sample code: ListRecommendationsServiceGroupResourceUri. + * + * @param manager Entry point to AdvisorManager. + */ + public static void + listRecommendationsServiceGroupResourceUri(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .listByTenant("providers/microsoft.management/serviceGroups/serviceGroupXYZ", null, 10, null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Recommendations_Update + +```java +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationPatchPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatePropertiesPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import java.time.OffsetDateTime; + +/** + * Samples for Recommendations Update. + */ +public final class RecommendationsUpdateSamples { + /* + * x-ms-original-file: 2026-08-01-preview/PatchRecommendationStateProperties.json + */ + /** + * Sample code: PatchRecommendationStateProperties. + * + * @param manager Entry point to AdvisorManager. + */ + public static void patchRecommendationStateProperties(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .updateWithResponse("2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45", + new RecommendationPatchPayload().withProperties( + new RecommendationStatePropertiesPayload().withRecommendationStatus(RecommendationStatus.POSTPONED) + .withRecommendationDismissReason(RecommendationDismissReason.fromString("NotRelevant")) + .withPostponedUntilDateTime(OffsetDateTime.parse("2024-09-01T00:00:00Z"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### Recommendations_UpdateByServiceGroup + +```java +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationPatchPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatePropertiesPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import java.time.OffsetDateTime; + +/** + * Samples for Recommendations UpdateByServiceGroup. + */ +public final class RecommendationsUpdateByServiceGroupSamples { + /* + * x-ms-original-file: 2026-08-01-preview/PatchRecommendationStatePropertiesByServiceGroup.json + */ + /** + * Sample code: PatchRecommendationStatePropertiesByServiceGroup. + * + * @param manager Entry point to AdvisorManager. + */ + public static void + patchRecommendationStatePropertiesByServiceGroup(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .updateByServiceGroupWithResponse("serviceGroupXYZ", + "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45", + new RecommendationPatchPayload().withProperties( + new RecommendationStatePropertiesPayload().withRecommendationStatus(RecommendationStatus.POSTPONED) + .withRecommendationDismissReason(RecommendationDismissReason.fromString("NotRelevant")) + .withPostponedUntilDateTime(OffsetDateTime.parse("2024-09-01T00:00:00Z"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### ResiliencyReviews_Get + +```java +/** + * Samples for ResiliencyReviews Get. + */ +public final class ResiliencyReviewsGetSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ResiliencyReviewsGet.json + */ + /** + * Sample code: GetResiliencyReview. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getResiliencyReview(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.resiliencyReviews() + .getWithResponse("11111111-1111-2222-3333-444444444444", com.azure.core.util.Context.NONE); + } +} +``` + +### ResiliencyReviews_List + +```java +/** + * Samples for ResiliencyReviews List. + */ +public final class ResiliencyReviewsListSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ResiliencyReviewsList.json */ /** - * Sample code: ListRecommendations. + * Sample code: ListResiliencyReviews. * * @param manager Entry point to AdvisorManager. */ - public static void listRecommendations(com.azure.resourcemanager.advisor.AdvisorManager manager) { - manager.recommendations().list(null, 10, null, com.azure.core.util.Context.NONE); + public static void listResiliencyReviews(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.resiliencyReviews().list(null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_Predict + +```java +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.PredictionRequest; +import com.azure.resourcemanager.advisor.models.PredictionType; +import java.nio.charset.StandardCharsets; + +/** + * Samples for ResourceProvider Predict. + */ +public final class ResourceProviderPredictSamples { + /* + * x-ms-original-file: 2026-08-01-preview/Predict.json + */ + /** + * Sample code: Predict. + * + * @param manager Entry point to AdvisorManager. + */ + public static void predict(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.resourceProviders() + .predictWithResponse(new PredictionRequest().withPredictionType(PredictionType.PREDICTIVE_RIGHTSIZING) + .withExtendedProperties(BinaryData.fromBytes( + "{region=CentralUS, deploymentType=Linux_IaaS_Software_Store, sku=Standard_Dv4, type=iaas, numberOfInstances=10}" + .getBytes(StandardCharsets.UTF_8))), + com.azure.core.util.Context.NONE); } } ``` @@ -324,8 +735,7 @@ public final class RecommendationsListSamples { */ public final class SuppressionsCreateSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/CreateSuppression.json + * x-ms-original-file: 2026-08-01-preview/CreateSuppression.json */ /** * Sample code: CreateSuppression. @@ -334,8 +744,9 @@ public final class SuppressionsCreateSamples { */ public static void createSuppression(com.azure.resourcemanager.advisor.AdvisorManager manager) { manager.suppressions() - .define("suppressionName1") - .withExistingRecommendation("resourceUri", "recommendationId") + .define("2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45") + .withExistingRecommendation("resourceUri", + "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b36") .withTtl("07:00:00:00") .create(); } @@ -350,8 +761,7 @@ public final class SuppressionsCreateSamples { */ public final class SuppressionsDeleteSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/DeleteSuppression.json + * x-ms-original-file: 2026-08-01-preview/DeleteSuppression.json */ /** * Sample code: DeleteSuppression. @@ -360,7 +770,7 @@ public final class SuppressionsDeleteSamples { */ public static void deleteSuppression(com.azure.resourcemanager.advisor.AdvisorManager manager) { manager.suppressions() - .deleteWithResponse("resourceUri", "recommendationId", "suppressionName1", + .deleteWithResponse("resourceUri", "recommendationId", "HardcodedSuppressionName", com.azure.core.util.Context.NONE); } } @@ -374,8 +784,7 @@ public final class SuppressionsDeleteSamples { */ public final class SuppressionsGetSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetSuppressionDetail.json + * x-ms-original-file: 2026-08-01-preview/GetSuppressionDetail.json */ /** * Sample code: GetSuppressionDetail. @@ -384,7 +793,8 @@ public final class SuppressionsGetSamples { */ public static void getSuppressionDetail(com.azure.resourcemanager.advisor.AdvisorManager manager) { manager.suppressions() - .getWithResponse("resourceUri", "recommendationId", "suppressionName1", com.azure.core.util.Context.NONE); + .getWithResponse("resourceUri", "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45", + "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b87", com.azure.core.util.Context.NONE); } } ``` @@ -397,8 +807,7 @@ public final class SuppressionsGetSamples { */ public final class SuppressionsListSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListSuppressions.json + * x-ms-original-file: 2026-08-01-preview/ListSuppressions.json */ /** * Sample code: ListSuppressions. @@ -411,3 +820,24 @@ public final class SuppressionsListSamples { } ``` +### Workloads_List + +```java +/** + * Samples for Workloads List. + */ +public final class WorkloadsListSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListWorkloads.json + */ + /** + * Sample code: GetWorkloads. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getWorkloads(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.workloads().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/advisor/azure-resourcemanager-advisor/pom.xml b/sdk/advisor/azure-resourcemanager-advisor/pom.xml index a03ed8793106f..b984d191c3901 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/pom.xml +++ b/sdk/advisor/azure-resourcemanager-advisor/pom.xml @@ -1,9 +1,9 @@ - + 4.0.0 com.azure @@ -18,7 +18,7 @@ jar Microsoft Azure SDK for Advisor Management - This package contains Microsoft Azure SDK for Advisor Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST APIs for Azure Advisor. Package tag package-2020-01. + This package contains Microsoft Azure SDK for Advisor Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST APIs for Azure Advisor Resiliency Reviews. Package api-version 2026-08-01-preview. https://github.com/Azure/azure-sdk-for-java @@ -45,7 +45,7 @@ UTF-8 0 0 - false + true diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/AdvisorManager.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/AdvisorManager.java index d1d742e1e8701..e75895199a829 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/AdvisorManager.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/AdvisorManager.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor; @@ -22,41 +22,67 @@ 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.advisor.fluent.AdvisorManagementClient; import com.azure.resourcemanager.advisor.implementation.AdvisorManagementClientBuilder; +import com.azure.resourcemanager.advisor.implementation.AdvisorScoresImpl; +import com.azure.resourcemanager.advisor.implementation.AssessmentTypesImpl; +import com.azure.resourcemanager.advisor.implementation.AssessmentsImpl; import com.azure.resourcemanager.advisor.implementation.ConfigurationsImpl; import com.azure.resourcemanager.advisor.implementation.OperationsImpl; import com.azure.resourcemanager.advisor.implementation.RecommendationMetadatasImpl; import com.azure.resourcemanager.advisor.implementation.RecommendationsImpl; +import com.azure.resourcemanager.advisor.implementation.ResiliencyReviewsImpl; +import com.azure.resourcemanager.advisor.implementation.ResourceProvidersImpl; import com.azure.resourcemanager.advisor.implementation.SuppressionsImpl; +import com.azure.resourcemanager.advisor.implementation.WorkloadsImpl; +import com.azure.resourcemanager.advisor.models.AdvisorScores; +import com.azure.resourcemanager.advisor.models.AssessmentTypes; +import com.azure.resourcemanager.advisor.models.Assessments; import com.azure.resourcemanager.advisor.models.Configurations; import com.azure.resourcemanager.advisor.models.Operations; import com.azure.resourcemanager.advisor.models.RecommendationMetadatas; import com.azure.resourcemanager.advisor.models.Recommendations; +import com.azure.resourcemanager.advisor.models.ResiliencyReviews; +import com.azure.resourcemanager.advisor.models.ResourceProviders; import com.azure.resourcemanager.advisor.models.Suppressions; +import com.azure.resourcemanager.advisor.models.Workloads; 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 AdvisorManager. - * REST APIs for Azure Advisor. + * REST APIs for Azure Advisor Resiliency Reviews. */ public final class AdvisorManager { - private RecommendationMetadatas recommendationMetadatas; + private ResourceProviders resourceProviders; - private Configurations configurations; + private Operations operations; - private Recommendations recommendations; + private RecommendationMetadatas recommendationMetadatas; - private Operations operations; + private Recommendations recommendations; private Suppressions suppressions; + private AdvisorScores advisorScores; + + private Assessments assessments; + + private ResiliencyReviews resiliencyReviews; + + private Configurations configurations; + + private AssessmentTypes assessmentTypes; + + private Workloads workloads; + private final AdvisorManagementClient clientObject; private AdvisorManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -109,6 +135,9 @@ public static Configurable configure() { */ 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-advisor.properties"); private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -216,12 +245,14 @@ public AdvisorManager authenticate(TokenCredential credential, AzureProfile prof 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.advisor") .append("/") - .append("1.0.0"); + .append(clientVersion); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -267,6 +298,30 @@ public AdvisorManager authenticate(TokenCredential credential, AzureProfile prof } } + /** + * Gets the resource collection API of ResourceProviders. + * + * @return Resource collection API of ResourceProviders. + */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** + * 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 RecommendationMetadatas. * @@ -280,18 +335,6 @@ public RecommendationMetadatas recommendationMetadatas() { return recommendationMetadatas; } - /** - * Gets the resource collection API of Configurations. It manages ConfigData. - * - * @return Resource collection API of Configurations. - */ - public Configurations configurations() { - if (this.configurations == null) { - this.configurations = new ConfigurationsImpl(clientObject.getConfigurations(), this); - } - return configurations; - } - /** * Gets the resource collection API of Recommendations. * @@ -304,18 +347,6 @@ public Recommendations recommendations() { return recommendations; } - /** - * 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 Suppressions. It manages SuppressionContract. * @@ -328,6 +359,78 @@ public Suppressions suppressions() { return suppressions; } + /** + * Gets the resource collection API of AdvisorScores. + * + * @return Resource collection API of AdvisorScores. + */ + public AdvisorScores advisorScores() { + if (this.advisorScores == null) { + this.advisorScores = new AdvisorScoresImpl(clientObject.getAdvisorScores(), this); + } + return advisorScores; + } + + /** + * Gets the resource collection API of Assessments. It manages AssessmentResult. + * + * @return Resource collection API of Assessments. + */ + public Assessments assessments() { + if (this.assessments == null) { + this.assessments = new AssessmentsImpl(clientObject.getAssessments(), this); + } + return assessments; + } + + /** + * Gets the resource collection API of ResiliencyReviews. + * + * @return Resource collection API of ResiliencyReviews. + */ + public ResiliencyReviews resiliencyReviews() { + if (this.resiliencyReviews == null) { + this.resiliencyReviews = new ResiliencyReviewsImpl(clientObject.getResiliencyReviews(), this); + } + return resiliencyReviews; + } + + /** + * Gets the resource collection API of Configurations. It manages ConfigData. + * + * @return Resource collection API of Configurations. + */ + public Configurations configurations() { + if (this.configurations == null) { + this.configurations = new ConfigurationsImpl(clientObject.getConfigurations(), this); + } + return configurations; + } + + /** + * Gets the resource collection API of AssessmentTypes. + * + * @return Resource collection API of AssessmentTypes. + */ + public AssessmentTypes assessmentTypes() { + if (this.assessmentTypes == null) { + this.assessmentTypes = new AssessmentTypesImpl(clientObject.getAssessmentTypes(), this); + } + return assessmentTypes; + } + + /** + * Gets the resource collection API of Workloads. + * + * @return Resource collection API of Workloads. + */ + public Workloads workloads() { + if (this.workloads == null) { + this.workloads = new WorkloadsImpl(clientObject.getWorkloads(), this); + } + return workloads; + } + /** * Gets wrapped service client AdvisorManagementClient providing direct access to the underlying auto-generated API * implementation, based on Azure REST API. diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorManagementClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorManagementClient.java index 4d9dd554bcfe4..66d7bae51bfbe 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorManagementClient.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorManagementClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent; @@ -12,26 +12,26 @@ */ public interface AdvisorManagementClient { /** - * Gets The Azure subscription ID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * Gets server parameter. + * Gets Service host. * * @return the endpoint value. */ String getEndpoint(); /** - * Gets Api Version. + * 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. * @@ -47,32 +47,32 @@ public interface AdvisorManagementClient { Duration getDefaultPollInterval(); /** - * Gets the RecommendationMetadatasClient object to access its operations. + * Gets the ResourceProvidersClient object to access its operations. * - * @return the RecommendationMetadatasClient object. + * @return the ResourceProvidersClient object. */ - RecommendationMetadatasClient getRecommendationMetadatas(); + ResourceProvidersClient getResourceProviders(); /** - * Gets the ConfigurationsClient object to access its operations. + * Gets the OperationsClient object to access its operations. * - * @return the ConfigurationsClient object. + * @return the OperationsClient object. */ - ConfigurationsClient getConfigurations(); + OperationsClient getOperations(); /** - * Gets the RecommendationsClient object to access its operations. + * Gets the RecommendationMetadatasClient object to access its operations. * - * @return the RecommendationsClient object. + * @return the RecommendationMetadatasClient object. */ - RecommendationsClient getRecommendations(); + RecommendationMetadatasClient getRecommendationMetadatas(); /** - * Gets the OperationsClient object to access its operations. + * Gets the RecommendationsClient object to access its operations. * - * @return the OperationsClient object. + * @return the RecommendationsClient object. */ - OperationsClient getOperations(); + RecommendationsClient getRecommendations(); /** * Gets the SuppressionsClient object to access its operations. @@ -80,4 +80,46 @@ public interface AdvisorManagementClient { * @return the SuppressionsClient object. */ SuppressionsClient getSuppressions(); + + /** + * Gets the AdvisorScoresClient object to access its operations. + * + * @return the AdvisorScoresClient object. + */ + AdvisorScoresClient getAdvisorScores(); + + /** + * Gets the AssessmentsClient object to access its operations. + * + * @return the AssessmentsClient object. + */ + AssessmentsClient getAssessments(); + + /** + * Gets the ResiliencyReviewsClient object to access its operations. + * + * @return the ResiliencyReviewsClient object. + */ + ResiliencyReviewsClient getResiliencyReviews(); + + /** + * Gets the ConfigurationsClient object to access its operations. + * + * @return the ConfigurationsClient object. + */ + ConfigurationsClient getConfigurations(); + + /** + * Gets the AssessmentTypesClient object to access its operations. + * + * @return the AssessmentTypesClient object. + */ + AssessmentTypesClient getAssessmentTypes(); + + /** + * Gets the WorkloadsClient object to access its operations. + * + * @return the WorkloadsClient object. + */ + WorkloadsClient getWorkloads(); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorScoresClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorScoresClient.java new file mode 100644 index 0000000000000..e9b91d81fd943 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorScoresClient.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.fluent.models.AdvisorScoreEntityInner; + +/** + * An instance of this class provides access to all the operations defined in AdvisorScoresClient. + */ +public interface AdvisorScoresClient { + /** + * Gets the advisor score. + * + * @param name The scope of Advisor score entity. + * @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 advisor score along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String name, Context context); + + /** + * Gets the advisor score. + * + * @param name The scope of Advisor score entity. + * @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 advisor score. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvisorScoreEntityInner get(String name); + + /** + * Gets the list of advisor scores. + * + * @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 list of advisor scores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the list of advisor scores. + * + * @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 list of advisor scores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentTypesClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentTypesClient.java new file mode 100644 index 0000000000000..91141e343fb74 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentTypesClient.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.advisor.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.advisor.fluent.models.AssessmentTypeResultInner; + +/** + * An instance of this class provides access to all the operations defined in AssessmentTypesClient. + */ +public interface AssessmentTypesClient { + /** + * Get assessment types list. + * + * Get list of Azure Advisor assessment types. + * + * @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 assessment types list. + * + * Get list of Azure Advisor assessment types as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get assessment types list. + * + * Get list of Azure Advisor assessment types. + * + * @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 assessment types list. + * + * Get list of Azure Advisor assessment types as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentsClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentsClient.java new file mode 100644 index 0000000000000..31fa163fba847 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentsClient.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.fluent.models.AssessmentResultInner; + +/** + * An instance of this class provides access to all the operations defined in AssessmentsClient. + */ +public interface AssessmentsClient { + /** + * Get an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 an existing Azure Advisor assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String assessmentName, Context context); + + /** + * Get an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 an existing Azure Advisor assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AssessmentResultInner get(String assessmentName); + + /** + * Create or Overwrite Azure Advisor assessment. + * + * @param assessmentName Advisor assessment name. + * @param assessmentContract The Azure Advisor assessment data structure. + * @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 Advisor assessment result data structure along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putWithResponse(String assessmentName, AssessmentResultInner assessmentContract, + Context context); + + /** + * Create or Overwrite Azure Advisor assessment. + * + * @param assessmentName Advisor assessment name. + * @param assessmentContract The Azure Advisor assessment data structure. + * @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 Advisor assessment result data structure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AssessmentResultInner put(String assessmentName, AssessmentResultInner assessmentContract); + + /** + * Delete an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 assessmentName, Context context); + + /** + * Delete an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 assessmentName); + + /** + * Get list of Azure Advisor assessments. + * + * @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 list of Azure Advisor assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get list of Azure Advisor assessments. + * + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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 list of Azure Advisor assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String top, String skiptoken, Context context); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ConfigurationsClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ConfigurationsClient.java index 0411e662bbaa3..2e8083d631a92 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ConfigurationsClient.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ConfigurationsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent; @@ -23,7 +23,7 @@ public interface ConfigurationsClient { * * @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 list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); @@ -37,7 +37,7 @@ public interface ConfigurationsClient { * @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 list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); @@ -81,7 +81,7 @@ Response createInSubscriptionWithResponse(ConfigurationName con * @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 list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroup); @@ -94,7 +94,7 @@ Response createInSubscriptionWithResponse(ConfigurationName con * @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 list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroup, Context context); diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/OperationsClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/OperationsClient.java index ba316720abe03..76f930c44c170 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/OperationsClient.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/OperationsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent; @@ -15,23 +15,23 @@ */ public interface OperationsClient { /** - * Lists all the available Advisor REST API 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 the list of Advisor operations as paginated response with {@link PagedIterable}. + * @return paged collection of OperationEntity items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); /** - * Lists all the available Advisor REST API operations. + * 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 the list of Advisor operations as paginated response with {@link PagedIterable}. + * @return paged collection of OperationEntity items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationMetadatasClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationMetadatasClient.java index f2e50ab0c401f..b338abe3c09bd 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationMetadatasClient.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationMetadatasClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent; @@ -57,6 +57,20 @@ public interface RecommendationMetadatasClient { /** * Gets the list of metadata entities. * + * @param filter The filter to apply to the recommendation metadata.<br>Filter can be applied to properties + * ['[recommendationCategory](#category)', '[recommendationSubCategory](#recommendationSubCategory)', + * 'RetirementDate'] with operators ['eq', 'and', 'le', 'ge']<br>The filter can also be applied to property + * ['[TrackingIds]']<br><br>âš  **Note:** `recommendationControl` is a legacy filter property and will be + * deprecated in the future. Please use `recommendationSubCategory` for filtering recommendation + * subcategory.<br><br>Valid options for recommendationSubCategory: ['BusinessContinuity', + * 'DisasterRecovery', 'HighAvailability', 'MonitoringAndAlerting', 'Other', 'Personalized', + * 'PrioritizedRecommendations', 'Scalability', 'ServiceUpgradeAndRetirement', + * 'Validation']<br><br>Example:<br>- $filter=recommendationCategory eq 'HighAvailability' and + * recommendationSubCategory eq 'ServiceUpgradeAndRetirement' and retirementDate ge '2024-01-01' and retirementDate + * le '2028-01-01'. Filter can be applied on trackingIds as well.<br>- $filter=trackingIds/any(t: t eq + * 'some-guid')<br><br>âš  **Note:** `trackingIDs` filter can be used for filtering one value at a time. + * The support to filter multiple values is not currently available. Also the support to add other filters along + * with `trackingIDs` is not available. * @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. @@ -64,5 +78,5 @@ public interface RecommendationMetadatasClient { * @return the list of metadata entities as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(Context context); + PagedIterable list(String filter, Context context); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationsClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationsClient.java index 67f03eb0353d3..678264c497ee1 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationsClient.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent; @@ -10,79 +10,133 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner; +import com.azure.resourcemanager.advisor.models.RecommendationListMode; +import com.azure.resourcemanager.advisor.models.RecommendationPatchPayload; import com.azure.resourcemanager.advisor.models.RecommendationsGenerateResponse; -import java.util.UUID; +import com.azure.resourcemanager.advisor.models.RecommendationsGetGenerateStatusResponse; /** * An instance of this class provides access to all the operations defined in RecommendationsClient. */ public interface RecommendationsClient { /** - * Initiates the recommendation generation or computation process for a subscription. This operation is - * asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * Obtains details of a cached recommendation. * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param recommendationId The recommendation 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 response. + * @return advisor Recommendation along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - RecommendationsGenerateResponse generateWithResponse(Context context); + Response getWithResponse(String resourceUri, String recommendationId, + Context context); /** - * Initiates the recommendation generation or computation process for a subscription. This operation is - * asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * Obtains details of a cached recommendation. * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param recommendationId The recommendation 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 advisor Recommendation. */ @ServiceMethod(returns = ReturnType.SINGLE) - void generate(); + ResourceRecommendationBaseInner get(String resourceUri, String recommendationId); /** - * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the - * generation recommendation. The URI of this API is returned in the Location field of the response header. + * Update the state of a Recommendation. * - * @param operationId The operation ID, which can be found from the Location field in the generate recommendation - * response header. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. * @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}. + * @return advisor Recommendation along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getGenerateStatusWithResponse(UUID operationId, Context context); + Response updateWithResponse(String recommendationId, + RecommendationPatchPayload properties, Context context); /** - * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the - * generation recommendation. The URI of this API is returned in the Location field of the response header. + * Update the state of a Recommendation. * - * @param operationId The operation ID, which can be found from the Location field in the generate recommendation - * response header. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. * @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 advisor Recommendation. */ @ServiceMethod(returns = ReturnType.SINGLE) - void getGenerateStatus(UUID operationId); + ResourceRecommendationBaseInner update(String recommendationId, RecommendationPatchPayload properties); + + /** + * Obtains recommendations for a subscription. + * + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Obtains recommendations for a subscription. + * + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'Critical'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, RecommendationListMode mode, Integer top, + String skipToken, Context context); /** * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking * generateRecommendations. * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of Advisor recommendations as paginated response with {@link PagedIterable}. + * @return the response of a ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(); + PagedIterable listByTenant(String resourceUri); /** * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking * generateRecommendations. * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. @@ -92,16 +146,63 @@ public interface RecommendationsClient { * @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 list of Advisor recommendations as paginated response with {@link PagedIterable}. + * @return the response of a ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable list(String filter, Integer top, String skipToken, Context context); + PagedIterable listByTenant(String resourceUri, String filter, Integer top, + String skipToken, Context context); /** - * Obtains details of a cached recommendation. + * Obtains recommendations for a service group. + * + * @param serviceGroupName The name of the service group. + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServiceGroup(String serviceGroupName); + + /** + * Obtains recommendations for a service group. + * + * @param serviceGroupName The name of the service group. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'High'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page. + * @param skipToken The page-continuation token for the next page. + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServiceGroup(String serviceGroupName, String filter, + RecommendationListMode mode, Integer top, String skipToken, Context context); + + /** + * Obtains details of a recommendation for a service group. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param serviceGroupName The name of the service group. * @param recommendationId The recommendation ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -110,14 +211,13 @@ public interface RecommendationsClient { * @return advisor Recommendation along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse(String resourceUri, String recommendationId, - Context context); + Response getByServiceGroupWithResponse(String serviceGroupName, + String recommendationId, Context context); /** - * Obtains details of a cached recommendation. + * Obtains details of a recommendation for a service group. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param serviceGroupName The name of the service group. * @param recommendationId The recommendation ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -125,5 +225,87 @@ Response getWithResponse(String resourceUri, St * @return advisor Recommendation. */ @ServiceMethod(returns = ReturnType.SINGLE) - ResourceRecommendationBaseInner get(String resourceUri, String recommendationId); + ResourceRecommendationBaseInner getByServiceGroup(String serviceGroupName, String recommendationId); + + /** + * Updates the state of a recommendation for a service group. + * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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 advisor Recommendation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateByServiceGroupWithResponse(String serviceGroupName, + String recommendationId, RecommendationPatchPayload properties, Context context); + + /** + * Updates the state of a recommendation for a service group. + * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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 advisor Recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceRecommendationBaseInner updateByServiceGroup(String serviceGroupName, String recommendationId, + RecommendationPatchPayload properties); + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is + * asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @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) + RecommendationsGenerateResponse generateWithResponse(Context context); + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is + * asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @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 generate(); + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the + * generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. + * @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) + RecommendationsGetGenerateStatusResponse getGenerateStatusWithResponse(String operationId, Context context); + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the + * generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. + * @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 getGenerateStatus(String operationId); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ResiliencyReviewsClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ResiliencyReviewsClient.java new file mode 100644 index 0000000000000..1825ddd53e633 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ResiliencyReviewsClient.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.fluent.models.ResiliencyReviewInner; + +/** + * An instance of this class provides access to all the operations defined in ResiliencyReviewsClient. + */ +public interface ResiliencyReviewsClient { + /** + * Get existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id. + * + * @param reviewId Existing review id. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @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 existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String reviewId, Context context); + + /** + * Get existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id. + * + * @param reviewId Existing review id. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @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 existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResiliencyReviewInner get(String reviewId); + + /** + * Get list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews. + * + * @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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews. + * + * @param top The number of items to be included in the result. + * @param skip The number of items to skip before starting to collect the result set. + * @param filter The filter to apply.<br>Filter can be applied to properties ['reviewStatus', 'reviewId'] with + * operators ['eq', 'and', 'or'].<br>Example:<br>- $filter=reviewStatus eq 'New'. + * @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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Integer top, Integer skip, String filter, Context context); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ResourceProvidersClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..35361de83024b --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/ResourceProvidersClient.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.advisor.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.advisor.fluent.models.PredictionResponseInner; +import com.azure.resourcemanager.advisor.models.PredictionRequest; + +/** + * An instance of this class provides access to all the operations defined in ResourceProvidersClient. + */ +public interface ResourceProvidersClient { + /** + * Predicts a recommendation. + * + * @param predictionRequest The request body. + * @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 response used by predictions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response predictWithResponse(PredictionRequest predictionRequest, Context context); + + /** + * Predicts a recommendation. + * + * @param predictionRequest The request body. + * @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 response used by predictions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PredictionResponseInner predict(PredictionRequest predictionRequest); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/SuppressionsClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/SuppressionsClient.java index 697364534b8a6..a3cd0194da4f1 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/SuppressionsClient.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/SuppressionsClient.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent; @@ -18,8 +18,7 @@ public interface SuppressionsClient { /** * Obtains the details of a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @param context The context to associate with this operation. @@ -38,8 +37,7 @@ Response getWithResponse(String resourceUri, String re /** * Obtains the details of a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -57,8 +55,7 @@ Response getWithResponse(String resourceUri, String re * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to * as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. @@ -79,8 +76,7 @@ Response createWithResponse(String resourceUri, String * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to * as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. @@ -100,8 +96,7 @@ SuppressionContractInner create(String resourceUri, String recommendationId, Str * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a * recommendation is referred to as a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @param context The context to associate with this operation. @@ -117,8 +112,7 @@ SuppressionContractInner create(String resourceUri, String recommendationId, Str * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a * recommendation is referred to as a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -134,7 +128,7 @@ SuppressionContractInner create(String resourceUri, String recommendationId, Str * * @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 list of Advisor suppressions as paginated response with {@link PagedIterable}. + * @return the response of a SuppressionContract list operation as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); @@ -149,7 +143,7 @@ SuppressionContractInner create(String resourceUri, String recommendationId, Str * @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 list of Advisor suppressions as paginated response with {@link PagedIterable}. + * @return the response of a SuppressionContract list operation as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Integer top, String skipToken, Context context); diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/WorkloadsClient.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/WorkloadsClient.java new file mode 100644 index 0000000000000..faffd53041d5a --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/WorkloadsClient.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.advisor.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.advisor.fluent.models.WorkloadResultInner; + +/** + * An instance of this class provides access to all the operations defined in WorkloadsClient. + */ +public interface WorkloadsClient { + /** + * Get Workloads list. + * + * Get list of Workloads. + * + * @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 workloads list. + * + * Get list of Workloads as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get Workloads list. + * + * Get list of Workloads. + * + * @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 workloads list. + * + * Get list of Workloads as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityInner.java new file mode 100644 index 0000000000000..89fdb881841e3 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityInner.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.advisor.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.advisor.models.ScoreEntity; +import com.azure.resourcemanager.advisor.models.TimeSeriesEntity; +import java.io.IOException; +import java.util.List; + +/** + * The details of Advisor score for a single category. + */ +@Immutable +public final class AdvisorScoreEntityInner extends ProxyResource { + /* + * The Advisor score data. + */ + private AdvisorScoreEntityProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AdvisorScoreEntityInner class. + */ + private AdvisorScoreEntityInner() { + } + + /** + * Get the innerProperties property: The Advisor score data. + * + * @return the innerProperties value. + */ + private AdvisorScoreEntityProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the lastRefreshedScore property: The details of latest available score. + * + * @return the lastRefreshedScore value. + */ + public ScoreEntity lastRefreshedScore() { + return this.innerProperties() == null ? null : this.innerProperties().lastRefreshedScore(); + } + + /** + * Get the timeSeries property: The historic Advisor score data. + * + * @return the timeSeries value. + */ + public List timeSeries() { + return this.innerProperties() == null ? null : this.innerProperties().timeSeries(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdvisorScoreEntityInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdvisorScoreEntityInner 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 AdvisorScoreEntityInner. + */ + public static AdvisorScoreEntityInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdvisorScoreEntityInner deserializedAdvisorScoreEntityInner = new AdvisorScoreEntityInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAdvisorScoreEntityInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAdvisorScoreEntityInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAdvisorScoreEntityInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAdvisorScoreEntityInner.innerProperties = AdvisorScoreEntityProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAdvisorScoreEntityInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAdvisorScoreEntityInner; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityProperties.java new file mode 100644 index 0000000000000..307806b2c07ea --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityProperties.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.models.ScoreEntity; +import com.azure.resourcemanager.advisor.models.TimeSeriesEntity; +import java.io.IOException; +import java.util.List; + +/** + * The Advisor score data. + */ +@Immutable +public final class AdvisorScoreEntityProperties implements JsonSerializable { + /* + * The details of latest available score. + */ + private ScoreEntity lastRefreshedScore; + + /* + * The historic Advisor score data. + */ + private List timeSeries; + + /** + * Creates an instance of AdvisorScoreEntityProperties class. + */ + private AdvisorScoreEntityProperties() { + } + + /** + * Get the lastRefreshedScore property: The details of latest available score. + * + * @return the lastRefreshedScore value. + */ + public ScoreEntity lastRefreshedScore() { + return this.lastRefreshedScore; + } + + /** + * Get the timeSeries property: The historic Advisor score data. + * + * @return the timeSeries value. + */ + public List timeSeries() { + return this.timeSeries; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("lastRefreshedScore", this.lastRefreshedScore); + jsonWriter.writeArrayField("timeSeries", this.timeSeries, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdvisorScoreEntityProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdvisorScoreEntityProperties 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 AdvisorScoreEntityProperties. + */ + public static AdvisorScoreEntityProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdvisorScoreEntityProperties deserializedAdvisorScoreEntityProperties = new AdvisorScoreEntityProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lastRefreshedScore".equals(fieldName)) { + deserializedAdvisorScoreEntityProperties.lastRefreshedScore = ScoreEntity.fromJson(reader); + } else if ("timeSeries".equals(fieldName)) { + List timeSeries = reader.readArray(reader1 -> TimeSeriesEntity.fromJson(reader1)); + deserializedAdvisorScoreEntityProperties.timeSeries = timeSeries; + } else { + reader.skipChildren(); + } + } + + return deserializedAdvisorScoreEntityProperties; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultInner.java new file mode 100644 index 0000000000000..9cc954afa0cf9 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultInner.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Advisor assessment result data structure. + */ +@Fluent +public final class AssessmentResultInner extends ProxyResource { + /* + * The Advisor assessment result properties structure. + */ + private AssessmentResultProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AssessmentResultInner class. + */ + public AssessmentResultInner() { + } + + /** + * Get the innerProperties property: The Advisor assessment result properties structure. + * + * @return the innerProperties value. + */ + private AssessmentResultProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the workloadId property: Workload Id. + * + * @return the workloadId value. + */ + public String workloadId() { + return this.innerProperties() == null ? null : this.innerProperties().workloadId(); + } + + /** + * Set the workloadId property: Workload Id. + * + * @param workloadId the workloadId value to set. + * @return the AssessmentResultInner object itself. + */ + public AssessmentResultInner withWorkloadId(String workloadId) { + if (this.innerProperties() == null) { + this.innerProperties = new AssessmentResultProperties(); + } + this.innerProperties().withWorkloadId(workloadId); + return this; + } + + /** + * Get the workloadName property: Workload Name. + * + * @return the workloadName value. + */ + public String workloadName() { + return this.innerProperties() == null ? null : this.innerProperties().workloadName(); + } + + /** + * Get the assessmentId property: Assessment Id. + * + * @return the assessmentId value. + */ + public String assessmentId() { + return this.innerProperties() == null ? null : this.innerProperties().assessmentId(); + } + + /** + * Get the description property: Assessment Type Description. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Get the typeId property: Assessment Type Id. + * + * @return the typeId value. + */ + public String typeId() { + return this.innerProperties() == null ? null : this.innerProperties().typeId(); + } + + /** + * Set the typeId property: Assessment Type Id. + * + * @param typeId the typeId value to set. + * @return the AssessmentResultInner object itself. + */ + public AssessmentResultInner withTypeId(String typeId) { + if (this.innerProperties() == null) { + this.innerProperties = new AssessmentResultProperties(); + } + this.innerProperties().withTypeId(typeId); + return this; + } + + /** + * Get the type property: Assessment Type. + * + * @return the type value. + */ + public String typePropertiesType() { + return this.innerProperties() == null ? null : this.innerProperties().type(); + } + + /** + * Get the score property: Assessment Score. + * + * @return the score value. + */ + public Integer score() { + return this.innerProperties() == null ? null : this.innerProperties().score(); + } + + /** + * Get the state property: Assessment State. + * + * @return the state value. + */ + public String state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Get the typeVersion property: Assessment Type Version. + * + * @return the typeVersion value. + */ + public String typeVersion() { + return this.innerProperties() == null ? null : this.innerProperties().typeVersion(); + } + + /** + * Get the locale property: Assessment Type Locale. + * + * @return the locale value. + */ + public String locale() { + return this.innerProperties() == null ? null : this.innerProperties().locale(); + } + + /** + * Set the locale property: Assessment Type Locale. + * + * @param locale the locale value to set. + * @return the AssessmentResultInner object itself. + */ + public AssessmentResultInner withLocale(String locale) { + if (this.innerProperties() == null) { + this.innerProperties = new AssessmentResultProperties(); + } + this.innerProperties().withLocale(locale); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssessmentResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssessmentResultInner 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 AssessmentResultInner. + */ + public static AssessmentResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssessmentResultInner deserializedAssessmentResultInner = new AssessmentResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAssessmentResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAssessmentResultInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAssessmentResultInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAssessmentResultInner.innerProperties = AssessmentResultProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAssessmentResultInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAssessmentResultInner; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultProperties.java new file mode 100644 index 0000000000000..619f0d0a8cfb2 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultProperties.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Assessment result properties. + */ +@Fluent +public final class AssessmentResultProperties implements JsonSerializable { + /* + * Workload Id. + */ + private String workloadId; + + /* + * Workload Name. + */ + private String workloadName; + + /* + * Assessment Id. + */ + private String assessmentId; + + /* + * Assessment Type Description. + */ + private String description; + + /* + * Assessment Type Id. + */ + private String typeId; + + /* + * Assessment Type. + */ + private String type; + + /* + * Assessment Score. + */ + private Integer score; + + /* + * Assessment State. + */ + private String state; + + /* + * Assessment Type Version. + */ + private String typeVersion; + + /* + * Assessment Type Locale. + */ + private String locale; + + /** + * Creates an instance of AssessmentResultProperties class. + */ + public AssessmentResultProperties() { + } + + /** + * Get the workloadId property: Workload Id. + * + * @return the workloadId value. + */ + public String workloadId() { + return this.workloadId; + } + + /** + * Set the workloadId property: Workload Id. + * + * @param workloadId the workloadId value to set. + * @return the AssessmentResultProperties object itself. + */ + public AssessmentResultProperties withWorkloadId(String workloadId) { + this.workloadId = workloadId; + return this; + } + + /** + * Get the workloadName property: Workload Name. + * + * @return the workloadName value. + */ + public String workloadName() { + return this.workloadName; + } + + /** + * Get the assessmentId property: Assessment Id. + * + * @return the assessmentId value. + */ + public String assessmentId() { + return this.assessmentId; + } + + /** + * Get the description property: Assessment Type Description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the typeId property: Assessment Type Id. + * + * @return the typeId value. + */ + public String typeId() { + return this.typeId; + } + + /** + * Set the typeId property: Assessment Type Id. + * + * @param typeId the typeId value to set. + * @return the AssessmentResultProperties object itself. + */ + public AssessmentResultProperties withTypeId(String typeId) { + this.typeId = typeId; + return this; + } + + /** + * Get the type property: Assessment Type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the score property: Assessment Score. + * + * @return the score value. + */ + public Integer score() { + return this.score; + } + + /** + * Get the state property: Assessment State. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the typeVersion property: Assessment Type Version. + * + * @return the typeVersion value. + */ + public String typeVersion() { + return this.typeVersion; + } + + /** + * Get the locale property: Assessment Type Locale. + * + * @return the locale value. + */ + public String locale() { + return this.locale; + } + + /** + * Set the locale property: Assessment Type Locale. + * + * @param locale the locale value to set. + * @return the AssessmentResultProperties object itself. + */ + public AssessmentResultProperties withLocale(String locale) { + this.locale = locale; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("workloadId", this.workloadId); + jsonWriter.writeStringField("typeId", this.typeId); + jsonWriter.writeStringField("locale", this.locale); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssessmentResultProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssessmentResultProperties 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 AssessmentResultProperties. + */ + public static AssessmentResultProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssessmentResultProperties deserializedAssessmentResultProperties = new AssessmentResultProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("workloadId".equals(fieldName)) { + deserializedAssessmentResultProperties.workloadId = reader.getString(); + } else if ("workloadName".equals(fieldName)) { + deserializedAssessmentResultProperties.workloadName = reader.getString(); + } else if ("assessmentId".equals(fieldName)) { + deserializedAssessmentResultProperties.assessmentId = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedAssessmentResultProperties.description = reader.getString(); + } else if ("typeId".equals(fieldName)) { + deserializedAssessmentResultProperties.typeId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAssessmentResultProperties.type = reader.getString(); + } else if ("score".equals(fieldName)) { + deserializedAssessmentResultProperties.score = reader.getNullable(JsonReader::getInt); + } else if ("state".equals(fieldName)) { + deserializedAssessmentResultProperties.state = reader.getString(); + } else if ("typeVersion".equals(fieldName)) { + deserializedAssessmentResultProperties.typeVersion = reader.getString(); + } else if ("locale".equals(fieldName)) { + deserializedAssessmentResultProperties.locale = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssessmentResultProperties; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentTypeResultInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentTypeResultInner.java new file mode 100644 index 0000000000000..3fcb5d99d2442 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentTypeResultInner.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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 java.io.IOException; + +/** + * The Advisor assessment type result data structure. + */ +@Immutable +public final class AssessmentTypeResultInner implements JsonSerializable { + /* + * Assessment Type Id + */ + private String id; + + /* + * Assessment Type Title + */ + private String title; + + /* + * Assessment Type Description + */ + private String description; + + /* + * Assessment Type Locale + */ + private String locale; + + /* + * Assessment Type Version + */ + private String version; + + /** + * Creates an instance of AssessmentTypeResultInner class. + */ + private AssessmentTypeResultInner() { + } + + /** + * Get the id property: Assessment Type Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the title property: Assessment Type Title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Get the description property: Assessment Type Description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the locale property: Assessment Type Locale. + * + * @return the locale value. + */ + public String locale() { + return this.locale; + } + + /** + * Get the version property: Assessment Type Version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("locale", this.locale); + jsonWriter.writeStringField("version", this.version); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AssessmentTypeResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssessmentTypeResultInner 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 AssessmentTypeResultInner. + */ + public static AssessmentTypeResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssessmentTypeResultInner deserializedAssessmentTypeResultInner = new AssessmentTypeResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAssessmentTypeResultInner.id = reader.getString(); + } else if ("title".equals(fieldName)) { + deserializedAssessmentTypeResultInner.title = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedAssessmentTypeResultInner.description = reader.getString(); + } else if ("locale".equals(fieldName)) { + deserializedAssessmentTypeResultInner.locale = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedAssessmentTypeResultInner.version = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssessmentTypeResultInner; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataInner.java index 5103b2f50be43..533e1103b7aae 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataInner.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataInner.java @@ -1,16 +1,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.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.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfig; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.io.IOException; import java.util.List; @@ -24,6 +26,11 @@ public final class ConfigDataInner extends ProxyResource { */ private ConfigDataProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -54,6 +61,15 @@ private ConfigDataProperties innerProperties() { return this.innerProperties; } + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the type property: The type of the resource. * @@ -132,6 +148,31 @@ public ConfigDataInner withLowCpuThreshold(CpuThreshold lowCpuThreshold) { return this; } + /** + * Get the duration property: Minimum duration for Advisor low CPU utilization evaluation. Valid only for + * subscriptions. Valid values: 7 (default), 14, 21, 30, 60 or 90. + * + * @return the duration value. + */ + public DurationModel duration() { + return this.innerProperties() == null ? null : this.innerProperties().duration(); + } + + /** + * Set the duration property: Minimum duration for Advisor low CPU utilization evaluation. Valid only for + * subscriptions. Valid values: 7 (default), 14, 21, 30, 60 or 90. + * + * @param duration the duration value to set. + * @return the ConfigDataInner object itself. + */ + public ConfigDataInner withDuration(DurationModel duration) { + if (this.innerProperties() == null) { + this.innerProperties = new ConfigDataProperties(); + } + this.innerProperties().withDuration(duration); + return this; + } + /** * Get the digests property: Advisor digest configuration. Valid only for subscriptions. * @@ -155,17 +196,6 @@ public ConfigDataInner withDigests(List digests) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } - } - /** * {@inheritDoc} */ @@ -200,6 +230,8 @@ public static ConfigDataInner fromJson(JsonReader jsonReader) throws IOException deserializedConfigDataInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { deserializedConfigDataInner.innerProperties = ConfigDataProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedConfigDataInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataProperties.java index 2879133c05f33..ed3e1178f190e 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataProperties.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataProperties.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent.models; @@ -11,6 +11,7 @@ import com.azure.json.JsonWriter; import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfig; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.io.IOException; import java.util.List; @@ -30,6 +31,12 @@ public final class ConfigDataProperties implements JsonSerializable digests) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (digests() != null) { - digests().forEach(e -> e.validate()); - } - } - /** * {@inheritDoc} */ @@ -123,6 +141,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeBooleanField("exclude", this.exclude); jsonWriter.writeStringField("lowCpuThreshold", this.lowCpuThreshold == null ? null : this.lowCpuThreshold.toString()); + jsonWriter.writeStringField("duration", this.duration == null ? null : this.duration.toString()); jsonWriter.writeArrayField("digests", this.digests, (writer, element) -> writer.writeJson(element)); return jsonWriter.writeEndObject(); } @@ -146,6 +165,8 @@ public static ConfigDataProperties fromJson(JsonReader jsonReader) throws IOExce deserializedConfigDataProperties.exclude = reader.getNullable(JsonReader::getBoolean); } else if ("lowCpuThreshold".equals(fieldName)) { deserializedConfigDataProperties.lowCpuThreshold = CpuThreshold.fromString(reader.getString()); + } else if ("duration".equals(fieldName)) { + deserializedConfigDataProperties.duration = DurationModel.fromString(reader.getString()); } else if ("digests".equals(fieldName)) { List digests = reader.readArray(reader1 -> DigestConfig.fromJson(reader1)); deserializedConfigDataProperties.digests = digests; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityInner.java index 1c323dd233c46..5523d28adf35d 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityInner.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityInner.java @@ -1,12 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent.models; -import com.azure.core.annotation.Fluent; +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.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.advisor.models.MetadataSupportedValueDetail; @@ -17,101 +18,85 @@ /** * The metadata entity contract. */ -@Fluent -public final class MetadataEntityInner implements JsonSerializable { +@Immutable +public final class MetadataEntityInner extends ProxyResource { /* - * The resource Id of the metadata entity. + * The metadata entity properties. */ - private String id; + private MetadataEntityProperties innerProperties; /* - * The type of the metadata entity. + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. */ private String type; /* - * The name of the metadata entity. + * The name of the resource. */ private String name; /* - * The metadata entity properties. + * Fully qualified resource Id for the resource. */ - private MetadataEntityProperties innerProperties; + private String id; /** * Creates an instance of MetadataEntityInner class. */ - public MetadataEntityInner() { + private MetadataEntityInner() { } /** - * Get the id property: The resource Id of the metadata entity. + * Get the innerProperties property: The metadata entity properties. * - * @return the id value. + * @return the innerProperties value. */ - public String id() { - return this.id; + private MetadataEntityProperties innerProperties() { + return this.innerProperties; } /** - * Set the id property: The resource Id of the metadata entity. + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @param id the id value to set. - * @return the MetadataEntityInner object itself. + * @return the systemData value. */ - public MetadataEntityInner withId(String id) { - this.id = id; - return this; + public SystemData systemData() { + return this.systemData; } /** - * Get the type property: The type of the metadata entity. + * Get the type property: The type of the resource. * * @return the type value. */ + @Override public String type() { return this.type; } /** - * Set the type property: The type of the metadata entity. - * - * @param type the type value to set. - * @return the MetadataEntityInner object itself. - */ - public MetadataEntityInner withType(String type) { - this.type = type; - return this; - } - - /** - * Get the name property: The name of the metadata entity. + * Get the name property: The name of the resource. * * @return the name value. */ + @Override public String name() { return this.name; } /** - * Set the name property: The name of the metadata entity. - * - * @param name the name value to set. - * @return the MetadataEntityInner object itself. - */ - public MetadataEntityInner withName(String name) { - this.name = name; - return this; - } - - /** - * Get the innerProperties property: The metadata entity properties. + * Get the id property: Fully qualified resource Id for the resource. * - * @return the innerProperties value. + * @return the id value. */ - private MetadataEntityProperties innerProperties() { - return this.innerProperties; + @Override + public String id() { + return this.id; } /** @@ -123,20 +108,6 @@ public String displayName() { return this.innerProperties() == null ? null : this.innerProperties().displayName(); } - /** - * Set the displayName property: The display name. - * - * @param displayName the displayName value to set. - * @return the MetadataEntityInner object itself. - */ - public MetadataEntityInner withDisplayName(String displayName) { - if (this.innerProperties() == null) { - this.innerProperties = new MetadataEntityProperties(); - } - this.innerProperties().withDisplayName(displayName); - return this; - } - /** * Get the dependsOn property: The list of keys on which this entity depends on. * @@ -146,20 +117,6 @@ public List dependsOn() { return this.innerProperties() == null ? null : this.innerProperties().dependsOn(); } - /** - * Set the dependsOn property: The list of keys on which this entity depends on. - * - * @param dependsOn the dependsOn value to set. - * @return the MetadataEntityInner object itself. - */ - public MetadataEntityInner withDependsOn(List dependsOn) { - if (this.innerProperties() == null) { - this.innerProperties = new MetadataEntityProperties(); - } - this.innerProperties().withDependsOn(dependsOn); - return this; - } - /** * Get the applicableScenarios property: The list of scenarios applicable to this metadata entity. * @@ -169,20 +126,6 @@ public List applicableScenarios() { return this.innerProperties() == null ? null : this.innerProperties().applicableScenarios(); } - /** - * Set the applicableScenarios property: The list of scenarios applicable to this metadata entity. - * - * @param applicableScenarios the applicableScenarios value to set. - * @return the MetadataEntityInner object itself. - */ - public MetadataEntityInner withApplicableScenarios(List applicableScenarios) { - if (this.innerProperties() == null) { - this.innerProperties = new MetadataEntityProperties(); - } - this.innerProperties().withApplicableScenarios(applicableScenarios); - return this; - } - /** * Get the supportedValues property: The list of supported values. * @@ -192,40 +135,12 @@ public List supportedValues() { return this.innerProperties() == null ? null : this.innerProperties().supportedValues(); } - /** - * Set the supportedValues property: The list of supported values. - * - * @param supportedValues the supportedValues value to set. - * @return the MetadataEntityInner object itself. - */ - public MetadataEntityInner withSupportedValues(List supportedValues) { - if (this.innerProperties() == null) { - this.innerProperties = new MetadataEntityProperties(); - } - this.innerProperties().withSupportedValues(supportedValues); - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } - } - /** * {@inheritDoc} */ @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", this.id); - jsonWriter.writeStringField("type", this.type); - jsonWriter.writeStringField("name", this.name); jsonWriter.writeJsonField("properties", this.innerProperties); return jsonWriter.writeEndObject(); } @@ -236,6 +151,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of MetadataEntityInner 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 MetadataEntityInner. */ public static MetadataEntityInner fromJson(JsonReader jsonReader) throws IOException { @@ -247,12 +163,14 @@ public static MetadataEntityInner fromJson(JsonReader jsonReader) throws IOExcep if ("id".equals(fieldName)) { deserializedMetadataEntityInner.id = reader.getString(); - } else if ("type".equals(fieldName)) { - deserializedMetadataEntityInner.type = reader.getString(); } else if ("name".equals(fieldName)) { deserializedMetadataEntityInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMetadataEntityInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { deserializedMetadataEntityInner.innerProperties = MetadataEntityProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedMetadataEntityInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityProperties.java index ea4042d9f2bf1..e0f1dfb35378e 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityProperties.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityProperties.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -17,7 +17,7 @@ /** * The metadata entity properties. */ -@Fluent +@Immutable public final class MetadataEntityProperties implements JsonSerializable { /* * The display name. @@ -42,7 +42,7 @@ public final class MetadataEntityProperties implements JsonSerializable dependsOn() { return this.dependsOn; } - /** - * Set the dependsOn property: The list of keys on which this entity depends on. - * - * @param dependsOn the dependsOn value to set. - * @return the MetadataEntityProperties object itself. - */ - public MetadataEntityProperties withDependsOn(List dependsOn) { - this.dependsOn = dependsOn; - return this; - } - /** * Get the applicableScenarios property: The list of scenarios applicable to this metadata entity. * @@ -94,17 +72,6 @@ public List applicableScenarios() { return this.applicableScenarios; } - /** - * Set the applicableScenarios property: The list of scenarios applicable to this metadata entity. - * - * @param applicableScenarios the applicableScenarios value to set. - * @return the MetadataEntityProperties object itself. - */ - public MetadataEntityProperties withApplicableScenarios(List applicableScenarios) { - this.applicableScenarios = applicableScenarios; - return this; - } - /** * Get the supportedValues property: The list of supported values. * @@ -114,28 +81,6 @@ public List supportedValues() { return this.supportedValues; } - /** - * Set the supportedValues property: The list of supported values. - * - * @param supportedValues the supportedValues value to set. - * @return the MetadataEntityProperties object itself. - */ - public MetadataEntityProperties withSupportedValues(List supportedValues) { - this.supportedValues = supportedValues; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedValues() != null) { - supportedValues().forEach(e -> e.validate()); - } - } - /** * {@inheritDoc} */ diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/OperationEntityInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/OperationEntityInner.java index 032431ed1d6ae..e06c28c3fac8d 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/OperationEntityInner.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/OperationEntityInner.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -15,7 +15,7 @@ /** * The operation supported by Advisor. */ -@Fluent +@Immutable public final class OperationEntityInner implements JsonSerializable { /* * Operation name: {provider}/{resource}/{operation}. @@ -30,7 +30,7 @@ public final class OperationEntityInner implements JsonSerializable { + /* + * Type of the prediction. + */ + private PredictionType predictionType; + + /* + * Extended properties are arguments specific for each prediction type. + */ + private BinaryData extendedProperties; + + /** + * Creates an instance of PredictionRequestProperties class. + */ + public PredictionRequestProperties() { + } + + /** + * Get the predictionType property: Type of the prediction. + * + * @return the predictionType value. + */ + public PredictionType predictionType() { + return this.predictionType; + } + + /** + * Set the predictionType property: Type of the prediction. + * + * @param predictionType the predictionType value to set. + * @return the PredictionRequestProperties object itself. + */ + public PredictionRequestProperties withPredictionType(PredictionType predictionType) { + this.predictionType = predictionType; + return this; + } + + /** + * Get the extendedProperties property: Extended properties are arguments specific for each prediction type. + * + * @return the extendedProperties value. + */ + public BinaryData extendedProperties() { + return this.extendedProperties; + } + + /** + * Set the extendedProperties property: Extended properties are arguments specific for each prediction type. + * + * @param extendedProperties the extendedProperties value to set. + * @return the PredictionRequestProperties object itself. + */ + public PredictionRequestProperties withExtendedProperties(BinaryData extendedProperties) { + this.extendedProperties = extendedProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("predictionType", + this.predictionType == null ? null : this.predictionType.toString()); + if (this.extendedProperties != null) { + jsonWriter.writeFieldName("extendedProperties"); + this.extendedProperties.writeTo(jsonWriter); + } + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PredictionRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PredictionRequestProperties 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 PredictionRequestProperties. + */ + public static PredictionRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PredictionRequestProperties deserializedPredictionRequestProperties = new PredictionRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("predictionType".equals(fieldName)) { + deserializedPredictionRequestProperties.predictionType + = PredictionType.fromString(reader.getString()); + } else if ("extendedProperties".equals(fieldName)) { + deserializedPredictionRequestProperties.extendedProperties + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else { + reader.skipChildren(); + } + } + + return deserializedPredictionRequestProperties; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseInner.java new file mode 100644 index 0000000000000..e7390f9fe5f39 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseInner.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.PredictionType; +import com.azure.resourcemanager.advisor.models.ShortDescription; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Response used by predictions. + */ +@Immutable +public final class PredictionResponseInner implements JsonSerializable { + /* + * The properties of the prediction. + */ + private PredictionResponseProperties innerProperties; + + /** + * Creates an instance of PredictionResponseInner class. + */ + private PredictionResponseInner() { + } + + /** + * Get the innerProperties property: The properties of the prediction. + * + * @return the innerProperties value. + */ + private PredictionResponseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the extendedProperties property: Extended properties. + * + * @return the extendedProperties value. + */ + public BinaryData extendedProperties() { + return this.innerProperties() == null ? null : this.innerProperties().extendedProperties(); + } + + /** + * Get the predictionType property: Type of the prediction. + * + * @return the predictionType value. + */ + public PredictionType predictionType() { + return this.innerProperties() == null ? null : this.innerProperties().predictionType(); + } + + /** + * Get the category property: The category of the recommendation. + * + * @return the category value. + */ + public Category category() { + return this.innerProperties() == null ? null : this.innerProperties().category(); + } + + /** + * Get the impact property: The business impact of the recommendation. + * + * @return the impact value. + */ + public Impact impact() { + return this.innerProperties() == null ? null : this.innerProperties().impact(); + } + + /** + * Get the impactedField property: The resource type identified by Advisor. + * + * @return the impactedField value. + */ + public String impactedField() { + return this.innerProperties() == null ? null : this.innerProperties().impactedField(); + } + + /** + * Get the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation. + * + * @return the lastUpdated value. + */ + public OffsetDateTime lastUpdated() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdated(); + } + + /** + * Get the shortDescription property: A summary of the recommendation. + * + * @return the shortDescription value. + */ + public ShortDescription shortDescription() { + return this.innerProperties() == null ? null : this.innerProperties().shortDescription(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PredictionResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PredictionResponseInner 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 PredictionResponseInner. + */ + public static PredictionResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PredictionResponseInner deserializedPredictionResponseInner = new PredictionResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedPredictionResponseInner.innerProperties = PredictionResponseProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPredictionResponseInner; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseProperties.java new file mode 100644 index 0000000000000..69330de83a061 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseProperties.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.PredictionType; +import com.azure.resourcemanager.advisor.models.ShortDescription; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Properties of the prediction. + */ +@Immutable +public final class PredictionResponseProperties implements JsonSerializable { + /* + * Extended properties + */ + private BinaryData extendedProperties; + + /* + * Type of the prediction. + */ + private PredictionType predictionType; + + /* + * The category of the recommendation. + */ + private Category category; + + /* + * The business impact of the recommendation. + */ + private Impact impact; + + /* + * The resource type identified by Advisor. + */ + private String impactedField; + + /* + * The most recent time that Advisor checked the validity of the recommendation. + */ + private OffsetDateTime lastUpdated; + + /* + * A summary of the recommendation. + */ + private ShortDescription shortDescription; + + /** + * Creates an instance of PredictionResponseProperties class. + */ + private PredictionResponseProperties() { + } + + /** + * Get the extendedProperties property: Extended properties. + * + * @return the extendedProperties value. + */ + public BinaryData extendedProperties() { + return this.extendedProperties; + } + + /** + * Get the predictionType property: Type of the prediction. + * + * @return the predictionType value. + */ + public PredictionType predictionType() { + return this.predictionType; + } + + /** + * Get the category property: The category of the recommendation. + * + * @return the category value. + */ + public Category category() { + return this.category; + } + + /** + * Get the impact property: The business impact of the recommendation. + * + * @return the impact value. + */ + public Impact impact() { + return this.impact; + } + + /** + * Get the impactedField property: The resource type identified by Advisor. + * + * @return the impactedField value. + */ + public String impactedField() { + return this.impactedField; + } + + /** + * Get the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation. + * + * @return the lastUpdated value. + */ + public OffsetDateTime lastUpdated() { + return this.lastUpdated; + } + + /** + * Get the shortDescription property: A summary of the recommendation. + * + * @return the shortDescription value. + */ + public ShortDescription shortDescription() { + return this.shortDescription; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + if (this.extendedProperties != null) { + jsonWriter.writeFieldName("extendedProperties"); + this.extendedProperties.writeTo(jsonWriter); + } + jsonWriter.writeStringField("predictionType", + this.predictionType == null ? null : this.predictionType.toString()); + jsonWriter.writeStringField("category", this.category == null ? null : this.category.toString()); + jsonWriter.writeStringField("impact", this.impact == null ? null : this.impact.toString()); + jsonWriter.writeStringField("impactedField", this.impactedField); + jsonWriter.writeStringField("lastUpdated", + this.lastUpdated == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdated)); + jsonWriter.writeJsonField("shortDescription", this.shortDescription); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PredictionResponseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PredictionResponseProperties 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 PredictionResponseProperties. + */ + public static PredictionResponseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PredictionResponseProperties deserializedPredictionResponseProperties = new PredictionResponseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("extendedProperties".equals(fieldName)) { + deserializedPredictionResponseProperties.extendedProperties + = reader.getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())); + } else if ("predictionType".equals(fieldName)) { + deserializedPredictionResponseProperties.predictionType + = PredictionType.fromString(reader.getString()); + } else if ("category".equals(fieldName)) { + deserializedPredictionResponseProperties.category = Category.fromString(reader.getString()); + } else if ("impact".equals(fieldName)) { + deserializedPredictionResponseProperties.impact = Impact.fromString(reader.getString()); + } else if ("impactedField".equals(fieldName)) { + deserializedPredictionResponseProperties.impactedField = reader.getString(); + } else if ("lastUpdated".equals(fieldName)) { + deserializedPredictionResponseProperties.lastUpdated = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("shortDescription".equals(fieldName)) { + deserializedPredictionResponseProperties.shortDescription = ShortDescription.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPredictionResponseProperties; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/RecommendationProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/RecommendationProperties.java index 0a497bddb0490..291db76e5bf98 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/RecommendationProperties.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/RecommendationProperties.java @@ -1,37 +1,49 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; import com.azure.core.util.CoreUtils; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationPropertiesResourceWorkload; +import com.azure.resourcemanager.advisor.models.RecommendationPropertiesReview; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; import com.azure.resourcemanager.advisor.models.ResourceMetadata; +import com.azure.resourcemanager.advisor.models.ResourceRecommendationSavings; +import com.azure.resourcemanager.advisor.models.Risk; import com.azure.resourcemanager.advisor.models.ShortDescription; +import com.azure.resourcemanager.advisor.models.TrackedRecommendationProperties; import java.io.IOException; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.UUID; /** * The properties of the recommendation. */ -@Fluent +@Immutable public final class RecommendationProperties implements JsonSerializable { /* * The category of the recommendation. */ private Category category; + /* + * The sub-category of the recommendation. + */ + private Control control; + /* * The business impact of the recommendation. */ @@ -48,29 +60,89 @@ public final class RecommendationProperties implements JsonSerializable metadata; + private Map metadata; /* * The recommendation-type GUID. */ private String recommendationTypeId; + /* + * The potential risk of not implementing the recommendation. + */ + private Risk risk; + /* * A summary of the recommendation. */ private ShortDescription shortDescription; /* - * The list of snoozed and dismissed rules for the recommendation. + * The single snoozed or dismissed rule for the recommendation. */ - private List suppressionIds; + private String suppressionId; /* * Extended properties @@ -105,22 +177,47 @@ public final class RecommendationProperties implements JsonSerializable> actions; + private List> actions; /* * The automated way to apply recommendation. */ - private Map remediation; + private Map remediation; /* * The recommendation metadata properties exposed to customer to provide additional information. */ - private Map exposedMetadataProperties; + private Map exposedMetadataProperties; + + /* + * The properties of a tracked recommendation. + */ + private TrackedRecommendationProperties trackedProperties; + + /* + * The Review that this Recommendation belongs to. + */ + private RecommendationPropertiesReview review; + + /* + * The Workload that this Resource belongs to. + */ + private RecommendationPropertiesResourceWorkload resourceWorkload; + + /* + * The Source System that this Recommendation originated from. + */ + private String sourceSystem; + + /* + * Additional notes for the Recommendation + */ + private String notes; /** * Creates an instance of RecommendationProperties class. */ - public RecommendationProperties() { + private RecommendationProperties() { } /** @@ -133,14 +230,12 @@ public Category category() { } /** - * Set the category property: The category of the recommendation. + * Get the control property: The sub-category of the recommendation. * - * @param category the category value to set. - * @return the RecommendationProperties object itself. + * @return the control value. */ - public RecommendationProperties withCategory(Category category) { - this.category = category; - return this; + public Control control() { + return this.control; } /** @@ -152,17 +247,6 @@ public Impact impact() { return this.impact; } - /** - * Set the impact property: The business impact of the recommendation. - * - * @param impact the impact value to set. - * @return the RecommendationProperties object itself. - */ - public RecommendationProperties withImpact(Impact impact) { - this.impact = impact; - return this; - } - /** * Get the impactedField property: The resource type identified by Advisor. * @@ -173,234 +257,212 @@ public String impactedField() { } /** - * Set the impactedField property: The resource type identified by Advisor. + * Get the impactedValue property: The resource identified by Advisor. * - * @param impactedField the impactedField value to set. - * @return the RecommendationProperties object itself. + * @return the impactedValue value. */ - public RecommendationProperties withImpactedField(String impactedField) { - this.impactedField = impactedField; - return this; + public String impactedValue() { + return this.impactedValue; } /** - * Get the impactedValue property: The resource identified by Advisor. + * Get the criticalityScore property: The criticality score assigned to the recommendation. * - * @return the impactedValue value. + * @return the criticalityScore value. */ - public String impactedValue() { - return this.impactedValue; + public String criticalityScore() { + return this.criticalityScore; } /** - * Set the impactedValue property: The resource identified by Advisor. + * Get the criticality property: The criticality assigned to the recommendation. * - * @param impactedValue the impactedValue value to set. - * @return the RecommendationProperties object itself. + * @return the criticality value. */ - public RecommendationProperties withImpactedValue(String impactedValue) { - this.impactedValue = impactedValue; - return this; + public String criticality() { + return this.criticality; } /** - * Get the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation. + * Get the scoreChangedAt property: The time when the recommendation's criticality score last changed. * - * @return the lastUpdated value. + * @return the scoreChangedAt value. */ - public OffsetDateTime lastUpdated() { - return this.lastUpdated; + public String scoreChangedAt() { + return this.scoreChangedAt; } /** - * Set the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation. + * Get the serviceGroupId property: The service group ID associated with the recommendation. * - * @param lastUpdated the lastUpdated value to set. - * @return the RecommendationProperties object itself. + * @return the serviceGroupId value. */ - public RecommendationProperties withLastUpdated(OffsetDateTime lastUpdated) { - this.lastUpdated = lastUpdated; - return this; + public String serviceGroupId() { + return this.serviceGroupId; } /** - * Get the metadata property: The recommendation metadata. + * Get the savings property: The estimated savings associated with the recommendation. * - * @return the metadata value. + * @return the savings value. */ - public Map metadata() { - return this.metadata; + public ResourceRecommendationSavings savings() { + return this.savings; } /** - * Set the metadata property: The recommendation metadata. + * Get the recommendationStatus property: The state of the Recommendation. * - * @param metadata the metadata value to set. - * @return the RecommendationProperties object itself. + * @return the recommendationStatus value. */ - public RecommendationProperties withMetadata(Map metadata) { - this.metadata = metadata; - return this; + public RecommendationStatus recommendationStatus() { + return this.recommendationStatus; } /** - * Get the recommendationTypeId property: The recommendation-type GUID. + * Get the completionType property: The type of recommendation completion, which is either MarkedByUser or + * SystemVerified. * - * @return the recommendationTypeId value. + * @return the completionType value. */ - public String recommendationTypeId() { - return this.recommendationTypeId; + public String completionType() { + return this.completionType; } /** - * Set the recommendationTypeId property: The recommendation-type GUID. + * Get the recommendationDismissReason property: The reason the Recommendation was dismissed. * - * @param recommendationTypeId the recommendationTypeId value to set. - * @return the RecommendationProperties object itself. + * @return the recommendationDismissReason value. */ - public RecommendationProperties withRecommendationTypeId(String recommendationTypeId) { - this.recommendationTypeId = recommendationTypeId; - return this; + public RecommendationDismissReason recommendationDismissReason() { + return this.recommendationDismissReason; } /** - * Get the shortDescription property: A summary of the recommendation. + * Get the postponedUntilDateTime property: The time the Recommendation was postponed until. * - * @return the shortDescription value. + * @return the postponedUntilDateTime value. */ - public ShortDescription shortDescription() { - return this.shortDescription; + public OffsetDateTime postponedUntilDateTime() { + return this.postponedUntilDateTime; } /** - * Set the shortDescription property: A summary of the recommendation. + * Get the lastRefreshed property: The most recent time Advisor evaluated the recommendation for validity + * (re-ingested). * - * @param shortDescription the shortDescription value to set. - * @return the RecommendationProperties object itself. + * @return the lastRefreshed value. */ - public RecommendationProperties withShortDescription(ShortDescription shortDescription) { - this.shortDescription = shortDescription; - return this; + public OffsetDateTime lastRefreshed() { + return this.lastRefreshed; } /** - * Get the suppressionIds property: The list of snoozed and dismissed rules for the recommendation. + * Get the lastUpdated property: The most recent time the recommendation state changed (manual or automated). * - * @return the suppressionIds value. + * @return the lastUpdated value. */ - public List suppressionIds() { - return this.suppressionIds; + public OffsetDateTime lastUpdated() { + return this.lastUpdated; } /** - * Set the suppressionIds property: The list of snoozed and dismissed rules for the recommendation. + * Get the createdTime property: The created time of the recommendation. * - * @param suppressionIds the suppressionIds value to set. - * @return the RecommendationProperties object itself. + * @return the createdTime value. */ - public RecommendationProperties withSuppressionIds(List suppressionIds) { - this.suppressionIds = suppressionIds; - return this; + public OffsetDateTime createdTime() { + return this.createdTime; } /** - * Get the extendedProperties property: Extended properties. + * Get the metadata property: The recommendation metadata. * - * @return the extendedProperties value. + * @return the metadata value. */ - public Map extendedProperties() { - return this.extendedProperties; + public Map metadata() { + return this.metadata; } /** - * Set the extendedProperties property: Extended properties. + * Get the recommendationTypeId property: The recommendation-type GUID. * - * @param extendedProperties the extendedProperties value to set. - * @return the RecommendationProperties object itself. + * @return the recommendationTypeId value. */ - public RecommendationProperties withExtendedProperties(Map extendedProperties) { - this.extendedProperties = extendedProperties; - return this; + public String recommendationTypeId() { + return this.recommendationTypeId; } /** - * Get the resourceMetadata property: Metadata of resource that was assessed. + * Get the risk property: The potential risk of not implementing the recommendation. * - * @return the resourceMetadata value. + * @return the risk value. */ - public ResourceMetadata resourceMetadata() { - return this.resourceMetadata; + public Risk risk() { + return this.risk; } /** - * Set the resourceMetadata property: Metadata of resource that was assessed. + * Get the shortDescription property: A summary of the recommendation. * - * @param resourceMetadata the resourceMetadata value to set. - * @return the RecommendationProperties object itself. + * @return the shortDescription value. */ - public RecommendationProperties withResourceMetadata(ResourceMetadata resourceMetadata) { - this.resourceMetadata = resourceMetadata; - return this; + public ShortDescription shortDescription() { + return this.shortDescription; } /** - * Get the description property: The detailed description of recommendation. + * Get the suppressionId property: The single snoozed or dismissed rule for the recommendation. * - * @return the description value. + * @return the suppressionId value. */ - public String description() { - return this.description; + public String suppressionId() { + return this.suppressionId; } /** - * Set the description property: The detailed description of recommendation. + * Get the extendedProperties property: Extended properties. * - * @param description the description value to set. - * @return the RecommendationProperties object itself. + * @return the extendedProperties value. */ - public RecommendationProperties withDescription(String description) { - this.description = description; - return this; + public Map extendedProperties() { + return this.extendedProperties; } /** - * Get the label property: The label of recommendation. + * Get the resourceMetadata property: Metadata of resource that was assessed. * - * @return the label value. + * @return the resourceMetadata value. */ - public String label() { - return this.label; + public ResourceMetadata resourceMetadata() { + return this.resourceMetadata; } /** - * Set the label property: The label of recommendation. + * Get the description property: The detailed description of recommendation. * - * @param label the label value to set. - * @return the RecommendationProperties object itself. + * @return the description value. */ - public RecommendationProperties withLabel(String label) { - this.label = label; - return this; + public String description() { + return this.description; } /** - * Get the learnMoreLink property: The link to learn more about recommendation and generation logic. + * Get the label property: The label of recommendation. * - * @return the learnMoreLink value. + * @return the label value. */ - public String learnMoreLink() { - return this.learnMoreLink; + public String label() { + return this.label; } /** - * Set the learnMoreLink property: The link to learn more about recommendation and generation logic. + * Get the learnMoreLink property: The link to learn more about recommendation and generation logic. * - * @param learnMoreLink the learnMoreLink value to set. - * @return the RecommendationProperties object itself. + * @return the learnMoreLink value. */ - public RecommendationProperties withLearnMoreLink(String learnMoreLink) { - this.learnMoreLink = learnMoreLink; - return this; + public String learnMoreLink() { + return this.learnMoreLink; } /** @@ -413,90 +475,76 @@ public String potentialBenefits() { } /** - * Set the potentialBenefits property: The potential benefit of implementing recommendation. + * Get the actions property: The list of recommended actions to implement recommendation. * - * @param potentialBenefits the potentialBenefits value to set. - * @return the RecommendationProperties object itself. + * @return the actions value. */ - public RecommendationProperties withPotentialBenefits(String potentialBenefits) { - this.potentialBenefits = potentialBenefits; - return this; + public List> actions() { + return this.actions; } /** - * Get the actions property: The list of recommended actions to implement recommendation. + * Get the remediation property: The automated way to apply recommendation. * - * @return the actions value. + * @return the remediation value. */ - public List> actions() { - return this.actions; + public Map remediation() { + return this.remediation; } /** - * Set the actions property: The list of recommended actions to implement recommendation. + * Get the exposedMetadataProperties property: The recommendation metadata properties exposed to customer to provide + * additional information. * - * @param actions the actions value to set. - * @return the RecommendationProperties object itself. + * @return the exposedMetadataProperties value. */ - public RecommendationProperties withActions(List> actions) { - this.actions = actions; - return this; + public Map exposedMetadataProperties() { + return this.exposedMetadataProperties; } /** - * Get the remediation property: The automated way to apply recommendation. + * Get the trackedProperties property: The properties of a tracked recommendation. * - * @return the remediation value. + * @return the trackedProperties value. */ - public Map remediation() { - return this.remediation; + public TrackedRecommendationProperties trackedProperties() { + return this.trackedProperties; } /** - * Set the remediation property: The automated way to apply recommendation. + * Get the review property: The Review that this Recommendation belongs to. * - * @param remediation the remediation value to set. - * @return the RecommendationProperties object itself. + * @return the review value. */ - public RecommendationProperties withRemediation(Map remediation) { - this.remediation = remediation; - return this; + public RecommendationPropertiesReview review() { + return this.review; } /** - * Get the exposedMetadataProperties property: The recommendation metadata properties exposed to customer to provide - * additional information. + * Get the resourceWorkload property: The Workload that this Resource belongs to. * - * @return the exposedMetadataProperties value. + * @return the resourceWorkload value. */ - public Map exposedMetadataProperties() { - return this.exposedMetadataProperties; + public RecommendationPropertiesResourceWorkload resourceWorkload() { + return this.resourceWorkload; } /** - * Set the exposedMetadataProperties property: The recommendation metadata properties exposed to customer to provide - * additional information. + * Get the sourceSystem property: The Source System that this Recommendation originated from. * - * @param exposedMetadataProperties the exposedMetadataProperties value to set. - * @return the RecommendationProperties object itself. + * @return the sourceSystem value. */ - public RecommendationProperties withExposedMetadataProperties(Map exposedMetadataProperties) { - this.exposedMetadataProperties = exposedMetadataProperties; - return this; + public String sourceSystem() { + return this.sourceSystem; } /** - * Validates the instance. + * Get the notes property: Additional notes for the Recommendation. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @return the notes value. */ - public void validate() { - if (shortDescription() != null) { - shortDescription().validate(); - } - if (resourceMetadata() != null) { - resourceMetadata().validate(); - } + public String notes() { + return this.notes; } /** @@ -506,16 +554,36 @@ public void validate() { public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("category", this.category == null ? null : this.category.toString()); + jsonWriter.writeStringField("control", this.control == null ? null : this.control.toString()); jsonWriter.writeStringField("impact", this.impact == null ? null : this.impact.toString()); jsonWriter.writeStringField("impactedField", this.impactedField); jsonWriter.writeStringField("impactedValue", this.impactedValue); + jsonWriter.writeStringField("recommendationStatus", + this.recommendationStatus == null ? null : this.recommendationStatus.toString()); + jsonWriter.writeStringField("completionType", this.completionType); + jsonWriter.writeStringField("recommendationDismissReason", + this.recommendationDismissReason == null ? null : this.recommendationDismissReason.toString()); + jsonWriter.writeStringField("postponedUntilDateTime", + this.postponedUntilDateTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.postponedUntilDateTime)); + jsonWriter.writeStringField("lastRefreshed", + this.lastRefreshed == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastRefreshed)); jsonWriter.writeStringField("lastUpdated", this.lastUpdated == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdated)); - jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeStringField("createdTime", + this.createdTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdTime)); + jsonWriter.writeMapField("metadata", this.metadata, (writer, element) -> { + if (element == null) { + writer.writeNull(); + } else { + element.writeTo(writer); + } + }); jsonWriter.writeStringField("recommendationTypeId", this.recommendationTypeId); + jsonWriter.writeStringField("risk", this.risk == null ? null : this.risk.toString()); jsonWriter.writeJsonField("shortDescription", this.shortDescription); - jsonWriter.writeArrayField("suppressionIds", this.suppressionIds, - (writer, element) -> writer.writeString(Objects.toString(element, null))); + jsonWriter.writeStringField("suppressionId", this.suppressionId); jsonWriter.writeMapField("extendedProperties", this.extendedProperties, (writer, element) -> writer.writeString(element)); jsonWriter.writeJsonField("resourceMetadata", this.resourceMetadata); @@ -524,10 +592,32 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStringField("learnMoreLink", this.learnMoreLink); jsonWriter.writeStringField("potentialBenefits", this.potentialBenefits); jsonWriter.writeArrayField("actions", this.actions, - (writer, element) -> writer.writeMap(element, (writer1, element1) -> writer1.writeUntyped(element1))); - jsonWriter.writeMapField("remediation", this.remediation, (writer, element) -> writer.writeUntyped(element)); - jsonWriter.writeMapField("exposedMetadataProperties", this.exposedMetadataProperties, - (writer, element) -> writer.writeUntyped(element)); + (writer, element) -> writer.writeMap(element, (writer1, element1) -> { + if (element1 == null) { + writer1.writeNull(); + } else { + element1.writeTo(writer1); + } + })); + jsonWriter.writeMapField("remediation", this.remediation, (writer, element) -> { + if (element == null) { + writer.writeNull(); + } else { + element.writeTo(writer); + } + }); + jsonWriter.writeMapField("exposedMetadataProperties", this.exposedMetadataProperties, (writer, element) -> { + if (element == null) { + writer.writeNull(); + } else { + element.writeTo(writer); + } + }); + jsonWriter.writeJsonField("trackedProperties", this.trackedProperties); + jsonWriter.writeJsonField("review", this.review); + jsonWriter.writeJsonField("resourceWorkload", this.resourceWorkload); + jsonWriter.writeStringField("sourceSystem", this.sourceSystem); + jsonWriter.writeStringField("notes", this.notes); return jsonWriter.writeEndObject(); } @@ -548,26 +638,56 @@ public static RecommendationProperties fromJson(JsonReader jsonReader) throws IO if ("category".equals(fieldName)) { deserializedRecommendationProperties.category = Category.fromString(reader.getString()); + } else if ("control".equals(fieldName)) { + deserializedRecommendationProperties.control = Control.fromString(reader.getString()); } else if ("impact".equals(fieldName)) { deserializedRecommendationProperties.impact = Impact.fromString(reader.getString()); } else if ("impactedField".equals(fieldName)) { deserializedRecommendationProperties.impactedField = reader.getString(); } else if ("impactedValue".equals(fieldName)) { deserializedRecommendationProperties.impactedValue = reader.getString(); + } else if ("criticalityScore".equals(fieldName)) { + deserializedRecommendationProperties.criticalityScore = reader.getString(); + } else if ("criticality".equals(fieldName)) { + deserializedRecommendationProperties.criticality = reader.getString(); + } else if ("scoreChangedAt".equals(fieldName)) { + deserializedRecommendationProperties.scoreChangedAt = reader.getString(); + } else if ("serviceGroupId".equals(fieldName)) { + deserializedRecommendationProperties.serviceGroupId = reader.getString(); + } else if ("savings".equals(fieldName)) { + deserializedRecommendationProperties.savings = ResourceRecommendationSavings.fromJson(reader); + } else if ("recommendationStatus".equals(fieldName)) { + deserializedRecommendationProperties.recommendationStatus + = RecommendationStatus.fromString(reader.getString()); + } else if ("completionType".equals(fieldName)) { + deserializedRecommendationProperties.completionType = reader.getString(); + } else if ("recommendationDismissReason".equals(fieldName)) { + deserializedRecommendationProperties.recommendationDismissReason + = RecommendationDismissReason.fromString(reader.getString()); + } else if ("postponedUntilDateTime".equals(fieldName)) { + deserializedRecommendationProperties.postponedUntilDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastRefreshed".equals(fieldName)) { + deserializedRecommendationProperties.lastRefreshed = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("lastUpdated".equals(fieldName)) { deserializedRecommendationProperties.lastUpdated = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createdTime".equals(fieldName)) { + deserializedRecommendationProperties.createdTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("metadata".equals(fieldName)) { - Map metadata = reader.readMap(reader1 -> reader1.readUntyped()); + Map metadata = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); deserializedRecommendationProperties.metadata = metadata; } else if ("recommendationTypeId".equals(fieldName)) { deserializedRecommendationProperties.recommendationTypeId = reader.getString(); + } else if ("risk".equals(fieldName)) { + deserializedRecommendationProperties.risk = Risk.fromString(reader.getString()); } else if ("shortDescription".equals(fieldName)) { deserializedRecommendationProperties.shortDescription = ShortDescription.fromJson(reader); - } else if ("suppressionIds".equals(fieldName)) { - List suppressionIds = reader.readArray( - reader1 -> reader1.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()))); - deserializedRecommendationProperties.suppressionIds = suppressionIds; + } else if ("suppressionId".equals(fieldName)) { + deserializedRecommendationProperties.suppressionId = reader.getString(); } else if ("extendedProperties".equals(fieldName)) { Map extendedProperties = reader.readMap(reader1 -> reader1.getString()); deserializedRecommendationProperties.extendedProperties = extendedProperties; @@ -582,15 +702,30 @@ public static RecommendationProperties fromJson(JsonReader jsonReader) throws IO } else if ("potentialBenefits".equals(fieldName)) { deserializedRecommendationProperties.potentialBenefits = reader.getString(); } else if ("actions".equals(fieldName)) { - List> actions - = reader.readArray(reader1 -> reader1.readMap(reader2 -> reader2.readUntyped())); + List> actions + = reader.readArray(reader1 -> reader1.readMap(reader2 -> reader2 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped())))); deserializedRecommendationProperties.actions = actions; } else if ("remediation".equals(fieldName)) { - Map remediation = reader.readMap(reader1 -> reader1.readUntyped()); + Map remediation = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); deserializedRecommendationProperties.remediation = remediation; } else if ("exposedMetadataProperties".equals(fieldName)) { - Map exposedMetadataProperties = reader.readMap(reader1 -> reader1.readUntyped()); + Map exposedMetadataProperties = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); deserializedRecommendationProperties.exposedMetadataProperties = exposedMetadataProperties; + } else if ("trackedProperties".equals(fieldName)) { + deserializedRecommendationProperties.trackedProperties + = TrackedRecommendationProperties.fromJson(reader); + } else if ("review".equals(fieldName)) { + deserializedRecommendationProperties.review = RecommendationPropertiesReview.fromJson(reader); + } else if ("resourceWorkload".equals(fieldName)) { + deserializedRecommendationProperties.resourceWorkload + = RecommendationPropertiesResourceWorkload.fromJson(reader); + } else if ("sourceSystem".equals(fieldName)) { + deserializedRecommendationProperties.sourceSystem = reader.getString(); + } else if ("notes".equals(fieldName)) { + deserializedRecommendationProperties.notes = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewInner.java new file mode 100644 index 0000000000000..a2e45e599a46c --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewInner.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.models.ReviewStatus; +import java.io.IOException; + +/** + * The Advisor resiliency review data structure. + */ +@Immutable +public final class ResiliencyReviewInner extends ProxyResource { + /* + * Advisor resiliency review properties. + */ + private ResiliencyReviewProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ResiliencyReviewInner class. + */ + private ResiliencyReviewInner() { + } + + /** + * Get the innerProperties property: Advisor resiliency review properties. + * + * @return the innerProperties value. + */ + private ResiliencyReviewProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the reviewName property: Review name. + * + * @return the reviewName value. + */ + public String reviewName() { + return this.innerProperties() == null ? null : this.innerProperties().reviewName(); + } + + /** + * Get the workloadName property: Workload Name. + * + * @return the workloadName value. + */ + public String workloadName() { + return this.innerProperties() == null ? null : this.innerProperties().workloadName(); + } + + /** + * Get the reviewStatus property: Review status. + * + * @return the reviewStatus value. + */ + public ReviewStatus reviewStatus() { + return this.innerProperties() == null ? null : this.innerProperties().reviewStatus(); + } + + /** + * Get the recommendationsCount property: Review recommendations count. + * + * @return the recommendationsCount value. + */ + public Integer recommendationsCount() { + return this.innerProperties() == null ? null : this.innerProperties().recommendationsCount(); + } + + /** + * Get the publishedAt property: Review last updated timestamp. + * + * @return the publishedAt value. + */ + public String publishedAt() { + return this.innerProperties() == null ? null : this.innerProperties().publishedAt(); + } + + /** + * Get the updatedAt property: Review last updated timestamp. + * + * @return the updatedAt value. + */ + public String updatedAt() { + return this.innerProperties() == null ? null : this.innerProperties().updatedAt(); + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResiliencyReviewInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResiliencyReviewInner 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 ResiliencyReviewInner. + */ + public static ResiliencyReviewInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResiliencyReviewInner deserializedResiliencyReviewInner = new ResiliencyReviewInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedResiliencyReviewInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedResiliencyReviewInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedResiliencyReviewInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedResiliencyReviewInner.innerProperties = ResiliencyReviewProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedResiliencyReviewInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedResiliencyReviewInner; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewProperties.java new file mode 100644 index 0000000000000..3e23b0c8e3b84 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewProperties.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.models.ReviewStatus; +import java.io.IOException; + +/** + * Resiliency review properties. + */ +@Immutable +public final class ResiliencyReviewProperties implements JsonSerializable { + /* + * Review name. + */ + private String reviewName; + + /* + * Workload Name. + */ + private String workloadName; + + /* + * Review status. + */ + private ReviewStatus reviewStatus; + + /* + * Review recommendations count. + */ + private Integer recommendationsCount; + + /* + * Review last updated timestamp. + */ + private String publishedAt; + + /* + * Review last updated timestamp. + */ + private String updatedAt; + + /** + * Creates an instance of ResiliencyReviewProperties class. + */ + private ResiliencyReviewProperties() { + } + + /** + * Get the reviewName property: Review name. + * + * @return the reviewName value. + */ + public String reviewName() { + return this.reviewName; + } + + /** + * Get the workloadName property: Workload Name. + * + * @return the workloadName value. + */ + public String workloadName() { + return this.workloadName; + } + + /** + * Get the reviewStatus property: Review status. + * + * @return the reviewStatus value. + */ + public ReviewStatus reviewStatus() { + return this.reviewStatus; + } + + /** + * Get the recommendationsCount property: Review recommendations count. + * + * @return the recommendationsCount value. + */ + public Integer recommendationsCount() { + return this.recommendationsCount; + } + + /** + * Get the publishedAt property: Review last updated timestamp. + * + * @return the publishedAt value. + */ + public String publishedAt() { + return this.publishedAt; + } + + /** + * Get the updatedAt property: Review last updated timestamp. + * + * @return the updatedAt value. + */ + public String updatedAt() { + return this.updatedAt; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResiliencyReviewProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResiliencyReviewProperties 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 ResiliencyReviewProperties. + */ + public static ResiliencyReviewProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResiliencyReviewProperties deserializedResiliencyReviewProperties = new ResiliencyReviewProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("reviewName".equals(fieldName)) { + deserializedResiliencyReviewProperties.reviewName = reader.getString(); + } else if ("workloadName".equals(fieldName)) { + deserializedResiliencyReviewProperties.workloadName = reader.getString(); + } else if ("reviewStatus".equals(fieldName)) { + deserializedResiliencyReviewProperties.reviewStatus = ReviewStatus.fromString(reader.getString()); + } else if ("recommendationsCount".equals(fieldName)) { + deserializedResiliencyReviewProperties.recommendationsCount + = reader.getNullable(JsonReader::getInt); + } else if ("publishedAt".equals(fieldName)) { + deserializedResiliencyReviewProperties.publishedAt = reader.getString(); + } else if ("updatedAt".equals(fieldName)) { + deserializedResiliencyReviewProperties.updatedAt = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResiliencyReviewProperties; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResourceRecommendationBaseInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResourceRecommendationBaseInner.java index 2ac66aad09609..a322e165d0cf3 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResourceRecommendationBaseInner.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResourceRecommendationBaseInner.java @@ -1,34 +1,48 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.BinaryData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationPropertiesResourceWorkload; +import com.azure.resourcemanager.advisor.models.RecommendationPropertiesReview; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; import com.azure.resourcemanager.advisor.models.ResourceMetadata; +import com.azure.resourcemanager.advisor.models.ResourceRecommendationSavings; +import com.azure.resourcemanager.advisor.models.Risk; import com.azure.resourcemanager.advisor.models.ShortDescription; +import com.azure.resourcemanager.advisor.models.TrackedRecommendationProperties; import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; import java.util.Map; -import java.util.UUID; /** * Advisor Recommendation. */ -@Fluent +@Immutable public final class ResourceRecommendationBaseInner extends ProxyResource { /* * The properties of the recommendation. */ private RecommendationProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -47,7 +61,7 @@ public final class ResourceRecommendationBaseInner extends ProxyResource { /** * Creates an instance of ResourceRecommendationBaseInner class. */ - public ResourceRecommendationBaseInner() { + private ResourceRecommendationBaseInner() { } /** @@ -59,6 +73,15 @@ private RecommendationProperties innerProperties() { return this.innerProperties; } + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the type property: The type of the resource. * @@ -99,17 +122,12 @@ public Category category() { } /** - * Set the category property: The category of the recommendation. + * Get the control property: The sub-category of the recommendation. * - * @param category the category value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the control value. */ - public ResourceRecommendationBaseInner withCategory(Category category) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withCategory(category); - return this; + public Control control() { + return this.innerProperties() == null ? null : this.innerProperties().control(); } /** @@ -121,20 +139,6 @@ public Impact impact() { return this.innerProperties() == null ? null : this.innerProperties().impact(); } - /** - * Set the impact property: The business impact of the recommendation. - * - * @param impact the impact value to set. - * @return the ResourceRecommendationBaseInner object itself. - */ - public ResourceRecommendationBaseInner withImpact(Impact impact) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withImpact(impact); - return this; - } - /** * Get the impactedField property: The resource type identified by Advisor. * @@ -145,270 +149,212 @@ public String impactedField() { } /** - * Set the impactedField property: The resource type identified by Advisor. + * Get the impactedValue property: The resource identified by Advisor. * - * @param impactedField the impactedField value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the impactedValue value. */ - public ResourceRecommendationBaseInner withImpactedField(String impactedField) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withImpactedField(impactedField); - return this; + public String impactedValue() { + return this.innerProperties() == null ? null : this.innerProperties().impactedValue(); } /** - * Get the impactedValue property: The resource identified by Advisor. + * Get the criticalityScore property: The criticality score assigned to the recommendation. * - * @return the impactedValue value. + * @return the criticalityScore value. */ - public String impactedValue() { - return this.innerProperties() == null ? null : this.innerProperties().impactedValue(); + public String criticalityScore() { + return this.innerProperties() == null ? null : this.innerProperties().criticalityScore(); } /** - * Set the impactedValue property: The resource identified by Advisor. + * Get the criticality property: The criticality assigned to the recommendation. * - * @param impactedValue the impactedValue value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the criticality value. */ - public ResourceRecommendationBaseInner withImpactedValue(String impactedValue) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withImpactedValue(impactedValue); - return this; + public String criticality() { + return this.innerProperties() == null ? null : this.innerProperties().criticality(); } /** - * Get the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation. + * Get the scoreChangedAt property: The time when the recommendation's criticality score last changed. * - * @return the lastUpdated value. + * @return the scoreChangedAt value. */ - public OffsetDateTime lastUpdated() { - return this.innerProperties() == null ? null : this.innerProperties().lastUpdated(); + public String scoreChangedAt() { + return this.innerProperties() == null ? null : this.innerProperties().scoreChangedAt(); } /** - * Set the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation. + * Get the serviceGroupId property: The service group ID associated with the recommendation. * - * @param lastUpdated the lastUpdated value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the serviceGroupId value. */ - public ResourceRecommendationBaseInner withLastUpdated(OffsetDateTime lastUpdated) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withLastUpdated(lastUpdated); - return this; + public String serviceGroupId() { + return this.innerProperties() == null ? null : this.innerProperties().serviceGroupId(); } /** - * Get the metadata property: The recommendation metadata. + * Get the savings property: The estimated savings associated with the recommendation. * - * @return the metadata value. + * @return the savings value. */ - public Map metadata() { - return this.innerProperties() == null ? null : this.innerProperties().metadata(); + public ResourceRecommendationSavings savings() { + return this.innerProperties() == null ? null : this.innerProperties().savings(); } /** - * Set the metadata property: The recommendation metadata. + * Get the recommendationStatus property: The state of the Recommendation. * - * @param metadata the metadata value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the recommendationStatus value. */ - public ResourceRecommendationBaseInner withMetadata(Map metadata) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withMetadata(metadata); - return this; + public RecommendationStatus recommendationStatus() { + return this.innerProperties() == null ? null : this.innerProperties().recommendationStatus(); } /** - * Get the recommendationTypeId property: The recommendation-type GUID. + * Get the completionType property: The type of recommendation completion, which is either MarkedByUser or + * SystemVerified. * - * @return the recommendationTypeId value. + * @return the completionType value. */ - public String recommendationTypeId() { - return this.innerProperties() == null ? null : this.innerProperties().recommendationTypeId(); + public String completionType() { + return this.innerProperties() == null ? null : this.innerProperties().completionType(); } /** - * Set the recommendationTypeId property: The recommendation-type GUID. + * Get the recommendationDismissReason property: The reason the Recommendation was dismissed. * - * @param recommendationTypeId the recommendationTypeId value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the recommendationDismissReason value. */ - public ResourceRecommendationBaseInner withRecommendationTypeId(String recommendationTypeId) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withRecommendationTypeId(recommendationTypeId); - return this; + public RecommendationDismissReason recommendationDismissReason() { + return this.innerProperties() == null ? null : this.innerProperties().recommendationDismissReason(); } /** - * Get the shortDescription property: A summary of the recommendation. + * Get the postponedUntilDateTime property: The time the Recommendation was postponed until. * - * @return the shortDescription value. + * @return the postponedUntilDateTime value. */ - public ShortDescription shortDescription() { - return this.innerProperties() == null ? null : this.innerProperties().shortDescription(); + public OffsetDateTime postponedUntilDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().postponedUntilDateTime(); } /** - * Set the shortDescription property: A summary of the recommendation. + * Get the lastRefreshed property: The most recent time Advisor evaluated the recommendation for validity + * (re-ingested). * - * @param shortDescription the shortDescription value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the lastRefreshed value. */ - public ResourceRecommendationBaseInner withShortDescription(ShortDescription shortDescription) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withShortDescription(shortDescription); - return this; + public OffsetDateTime lastRefreshed() { + return this.innerProperties() == null ? null : this.innerProperties().lastRefreshed(); } /** - * Get the suppressionIds property: The list of snoozed and dismissed rules for the recommendation. + * Get the lastUpdated property: The most recent time the recommendation state changed (manual or automated). * - * @return the suppressionIds value. + * @return the lastUpdated value. */ - public List suppressionIds() { - return this.innerProperties() == null ? null : this.innerProperties().suppressionIds(); + public OffsetDateTime lastUpdated() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdated(); } /** - * Set the suppressionIds property: The list of snoozed and dismissed rules for the recommendation. + * Get the createdTime property: The created time of the recommendation. * - * @param suppressionIds the suppressionIds value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the createdTime value. */ - public ResourceRecommendationBaseInner withSuppressionIds(List suppressionIds) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withSuppressionIds(suppressionIds); - return this; + public OffsetDateTime createdTime() { + return this.innerProperties() == null ? null : this.innerProperties().createdTime(); } /** - * Get the extendedProperties property: Extended properties. + * Get the metadata property: The recommendation metadata. * - * @return the extendedProperties value. + * @return the metadata value. */ - public Map extendedProperties() { - return this.innerProperties() == null ? null : this.innerProperties().extendedProperties(); + public Map metadata() { + return this.innerProperties() == null ? null : this.innerProperties().metadata(); } /** - * Set the extendedProperties property: Extended properties. + * Get the recommendationTypeId property: The recommendation-type GUID. * - * @param extendedProperties the extendedProperties value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the recommendationTypeId value. */ - public ResourceRecommendationBaseInner withExtendedProperties(Map extendedProperties) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withExtendedProperties(extendedProperties); - return this; + public String recommendationTypeId() { + return this.innerProperties() == null ? null : this.innerProperties().recommendationTypeId(); } /** - * Get the resourceMetadata property: Metadata of resource that was assessed. + * Get the risk property: The potential risk of not implementing the recommendation. * - * @return the resourceMetadata value. + * @return the risk value. */ - public ResourceMetadata resourceMetadata() { - return this.innerProperties() == null ? null : this.innerProperties().resourceMetadata(); + public Risk risk() { + return this.innerProperties() == null ? null : this.innerProperties().risk(); } /** - * Set the resourceMetadata property: Metadata of resource that was assessed. + * Get the shortDescription property: A summary of the recommendation. * - * @param resourceMetadata the resourceMetadata value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the shortDescription value. */ - public ResourceRecommendationBaseInner withResourceMetadata(ResourceMetadata resourceMetadata) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withResourceMetadata(resourceMetadata); - return this; + public ShortDescription shortDescription() { + return this.innerProperties() == null ? null : this.innerProperties().shortDescription(); } /** - * Get the description property: The detailed description of recommendation. + * Get the suppressionId property: The single snoozed or dismissed rule for the recommendation. * - * @return the description value. + * @return the suppressionId value. */ - public String description() { - return this.innerProperties() == null ? null : this.innerProperties().description(); + public String suppressionId() { + return this.innerProperties() == null ? null : this.innerProperties().suppressionId(); } /** - * Set the description property: The detailed description of recommendation. + * Get the extendedProperties property: Extended properties. * - * @param description the description value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the extendedProperties value. */ - public ResourceRecommendationBaseInner withDescription(String description) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withDescription(description); - return this; + public Map extendedProperties() { + return this.innerProperties() == null ? null : this.innerProperties().extendedProperties(); } /** - * Get the label property: The label of recommendation. + * Get the resourceMetadata property: Metadata of resource that was assessed. * - * @return the label value. + * @return the resourceMetadata value. */ - public String label() { - return this.innerProperties() == null ? null : this.innerProperties().label(); + public ResourceMetadata resourceMetadata() { + return this.innerProperties() == null ? null : this.innerProperties().resourceMetadata(); } /** - * Set the label property: The label of recommendation. + * Get the description property: The detailed description of recommendation. * - * @param label the label value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the description value. */ - public ResourceRecommendationBaseInner withLabel(String label) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withLabel(label); - return this; + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); } /** - * Get the learnMoreLink property: The link to learn more about recommendation and generation logic. + * Get the label property: The label of recommendation. * - * @return the learnMoreLink value. + * @return the label value. */ - public String learnMoreLink() { - return this.innerProperties() == null ? null : this.innerProperties().learnMoreLink(); + public String label() { + return this.innerProperties() == null ? null : this.innerProperties().label(); } /** - * Set the learnMoreLink property: The link to learn more about recommendation and generation logic. + * Get the learnMoreLink property: The link to learn more about recommendation and generation logic. * - * @param learnMoreLink the learnMoreLink value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the learnMoreLink value. */ - public ResourceRecommendationBaseInner withLearnMoreLink(String learnMoreLink) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withLearnMoreLink(learnMoreLink); - return this; + public String learnMoreLink() { + return this.innerProperties() == null ? null : this.innerProperties().learnMoreLink(); } /** @@ -421,100 +367,76 @@ public String potentialBenefits() { } /** - * Set the potentialBenefits property: The potential benefit of implementing recommendation. + * Get the actions property: The list of recommended actions to implement recommendation. * - * @param potentialBenefits the potentialBenefits value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the actions value. */ - public ResourceRecommendationBaseInner withPotentialBenefits(String potentialBenefits) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withPotentialBenefits(potentialBenefits); - return this; + public List> actions() { + return this.innerProperties() == null ? null : this.innerProperties().actions(); } /** - * Get the actions property: The list of recommended actions to implement recommendation. + * Get the remediation property: The automated way to apply recommendation. * - * @return the actions value. + * @return the remediation value. */ - public List> actions() { - return this.innerProperties() == null ? null : this.innerProperties().actions(); + public Map remediation() { + return this.innerProperties() == null ? null : this.innerProperties().remediation(); } /** - * Set the actions property: The list of recommended actions to implement recommendation. + * Get the exposedMetadataProperties property: The recommendation metadata properties exposed to customer to provide + * additional information. * - * @param actions the actions value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the exposedMetadataProperties value. */ - public ResourceRecommendationBaseInner withActions(List> actions) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withActions(actions); - return this; + public Map exposedMetadataProperties() { + return this.innerProperties() == null ? null : this.innerProperties().exposedMetadataProperties(); } /** - * Get the remediation property: The automated way to apply recommendation. + * Get the trackedProperties property: The properties of a tracked recommendation. * - * @return the remediation value. + * @return the trackedProperties value. */ - public Map remediation() { - return this.innerProperties() == null ? null : this.innerProperties().remediation(); + public TrackedRecommendationProperties trackedProperties() { + return this.innerProperties() == null ? null : this.innerProperties().trackedProperties(); } /** - * Set the remediation property: The automated way to apply recommendation. + * Get the review property: The Review that this Recommendation belongs to. * - * @param remediation the remediation value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the review value. */ - public ResourceRecommendationBaseInner withRemediation(Map remediation) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withRemediation(remediation); - return this; + public RecommendationPropertiesReview review() { + return this.innerProperties() == null ? null : this.innerProperties().review(); } /** - * Get the exposedMetadataProperties property: The recommendation metadata properties exposed to customer to provide - * additional information. + * Get the resourceWorkload property: The Workload that this Resource belongs to. * - * @return the exposedMetadataProperties value. + * @return the resourceWorkload value. */ - public Map exposedMetadataProperties() { - return this.innerProperties() == null ? null : this.innerProperties().exposedMetadataProperties(); + public RecommendationPropertiesResourceWorkload resourceWorkload() { + return this.innerProperties() == null ? null : this.innerProperties().resourceWorkload(); } /** - * Set the exposedMetadataProperties property: The recommendation metadata properties exposed to customer to provide - * additional information. + * Get the sourceSystem property: The Source System that this Recommendation originated from. * - * @param exposedMetadataProperties the exposedMetadataProperties value to set. - * @return the ResourceRecommendationBaseInner object itself. + * @return the sourceSystem value. */ - public ResourceRecommendationBaseInner - withExposedMetadataProperties(Map exposedMetadataProperties) { - if (this.innerProperties() == null) { - this.innerProperties = new RecommendationProperties(); - } - this.innerProperties().withExposedMetadataProperties(exposedMetadataProperties); - return this; + public String sourceSystem() { + return this.innerProperties() == null ? null : this.innerProperties().sourceSystem(); } /** - * Validates the instance. + * Get the notes property: Additional notes for the Recommendation. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @return the notes value. */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } + public String notes() { + return this.innerProperties() == null ? null : this.innerProperties().notes(); } /** @@ -553,6 +475,8 @@ public static ResourceRecommendationBaseInner fromJson(JsonReader jsonReader) th } else if ("properties".equals(fieldName)) { deserializedResourceRecommendationBaseInner.innerProperties = RecommendationProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedResourceRecommendationBaseInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionContractInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionContractInner.java index 1a78e97c5a5c0..f6202050f04ce 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionContractInner.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionContractInner.java @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.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; @@ -22,6 +23,11 @@ public final class SuppressionContractInner extends ProxyResource { */ private SuppressionProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -52,6 +58,15 @@ private SuppressionProperties innerProperties() { return this.innerProperties; } + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + /** * Get the type property: The type of the resource. * @@ -129,23 +144,12 @@ public SuppressionContractInner withTtl(String ttl) { } /** - * Get the expirationTimestamp property: Gets or sets the expiration time stamp. + * Get the expirationTimeStamp property: Gets or sets the expiration time stamp. * - * @return the expirationTimestamp value. + * @return the expirationTimeStamp value. */ - public OffsetDateTime expirationTimestamp() { - return this.innerProperties() == null ? null : this.innerProperties().expirationTimestamp(); - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (innerProperties() != null) { - innerProperties().validate(); - } + public OffsetDateTime expirationTimeStamp() { + return this.innerProperties() == null ? null : this.innerProperties().expirationTimeStamp(); } /** @@ -182,6 +186,8 @@ public static SuppressionContractInner fromJson(JsonReader jsonReader) throws IO deserializedSuppressionContractInner.type = reader.getString(); } else if ("properties".equals(fieldName)) { deserializedSuppressionContractInner.innerProperties = SuppressionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSuppressionContractInner.systemData = SystemData.fromJson(reader); } else { reader.skipChildren(); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionProperties.java index 95d20d3b92910..d38c778b19263 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionProperties.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionProperties.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.fluent.models; @@ -31,7 +31,7 @@ public final class SuppressionProperties implements JsonSerializable CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else { reader.skipChildren(); diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/WorkloadResultInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/WorkloadResultInner.java new file mode 100644 index 0000000000000..b645c2f789074 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/WorkloadResultInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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 java.io.IOException; + +/** + * The Workload result data structure. + */ +@Immutable +public final class WorkloadResultInner implements JsonSerializable { + /* + * Workload Id + */ + private String id; + + /* + * Workload Name + */ + private String name; + + /* + * Subscription Id + */ + private String subscriptionId; + + /* + * Subscription Name + */ + private String subscriptionName; + + /** + * Creates an instance of WorkloadResultInner class. + */ + private WorkloadResultInner() { + } + + /** + * Get the id property: Workload Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: Workload Name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the subscriptionId property: Subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the subscriptionName property: Subscription Name. + * + * @return the subscriptionName value. + */ + public String subscriptionName() { + return this.subscriptionName; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + jsonWriter.writeStringField("subscriptionName", this.subscriptionName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadResultInner 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 WorkloadResultInner. + */ + public static WorkloadResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadResultInner deserializedWorkloadResultInner = new WorkloadResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkloadResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkloadResultInner.name = reader.getString(); + } else if ("subscriptionId".equals(fieldName)) { + deserializedWorkloadResultInner.subscriptionId = reader.getString(); + } else if ("subscriptionName".equals(fieldName)) { + deserializedWorkloadResultInner.subscriptionName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadResultInner; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/package-info.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/package-info.java index 9d1e90d766eb4..7654314b4e075 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/package-info.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the inner data models for AdvisorManagementClient. - * REST APIs for Azure Advisor. + * Package containing the inner data models for Advisor. + * REST APIs for Azure Advisor Resiliency Reviews. */ package com.azure.resourcemanager.advisor.fluent.models; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/package-info.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/package-info.java index 0a367cf828558..5e542986f284c 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/package-info.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the service clients for AdvisorManagementClient. - * REST APIs for Azure Advisor. + * Package containing the service clients for Advisor. + * REST APIs for Azure Advisor Resiliency Reviews. */ package com.azure.resourcemanager.advisor.fluent; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientBuilder.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientBuilder.java index 3f21e8d1d7dd9..363e78bafc728 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientBuilder.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientBuilder.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; @@ -20,34 +20,34 @@ @ServiceClientBuilder(serviceClients = { AdvisorManagementClientImpl.class }) public final class AdvisorManagementClientBuilder { /* - * The Azure subscription ID. + * Service host */ - private String subscriptionId; + private String endpoint; /** - * Sets The Azure subscription ID. + * Sets Service host. * - * @param subscriptionId the subscriptionId value. + * @param endpoint the endpoint value. * @return the AdvisorManagementClientBuilder. */ - public AdvisorManagementClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; + public AdvisorManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; return this; } /* - * server parameter + * The ID of the target subscription. The value must be an UUID. */ - private String endpoint; + private String subscriptionId; /** - * Sets server parameter. + * Sets The ID of the target subscription. The value must be an UUID. * - * @param endpoint the endpoint value. + * @param subscriptionId the subscriptionId value. * @return the AdvisorManagementClientBuilder. */ - public AdvisorManagementClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; + public AdvisorManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; return this; } @@ -132,7 +132,7 @@ public AdvisorManagementClientImpl buildClient() { ? serializerAdapter : SerializerFactory.createDefaultManagementSerializerAdapter(); AdvisorManagementClientImpl client = new AdvisorManagementClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); return client; } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java index 93357dba27d7e..07bc470f422e8 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; @@ -15,20 +15,29 @@ 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.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; 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.polling.SyncPoller; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.advisor.fluent.AdvisorManagementClient; +import com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient; +import com.azure.resourcemanager.advisor.fluent.AssessmentTypesClient; +import com.azure.resourcemanager.advisor.fluent.AssessmentsClient; import com.azure.resourcemanager.advisor.fluent.ConfigurationsClient; import com.azure.resourcemanager.advisor.fluent.OperationsClient; import com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient; import com.azure.resourcemanager.advisor.fluent.RecommendationsClient; +import com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient; +import com.azure.resourcemanager.advisor.fluent.ResourceProvidersClient; import com.azure.resourcemanager.advisor.fluent.SuppressionsClient; +import com.azure.resourcemanager.advisor.fluent.WorkloadsClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -44,26 +53,12 @@ @ServiceClient(builder = AdvisorManagementClientBuilder.class) public final class AdvisorManagementClientImpl implements AdvisorManagementClient { /** - * The Azure subscription ID. - */ - private final String subscriptionId; - - /** - * Gets The Azure subscription ID. - * - * @return the subscriptionId value. - */ - public String getSubscriptionId() { - return this.subscriptionId; - } - - /** - * server parameter. + * Service host. */ private final String endpoint; /** - * Gets server parameter. + * Gets Service host. * * @return the endpoint value. */ @@ -72,12 +67,12 @@ public String getEndpoint() { } /** - * Api Version. + * Version parameter. */ private final String apiVersion; /** - * Gets Api Version. + * Gets Version parameter. * * @return the apiVersion value. */ @@ -85,6 +80,20 @@ 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. */ @@ -128,59 +137,59 @@ public Duration getDefaultPollInterval() { } /** - * The RecommendationMetadatasClient object to access its operations. + * The ResourceProvidersClient object to access its operations. */ - private final RecommendationMetadatasClient recommendationMetadatas; + private final ResourceProvidersClient resourceProviders; /** - * Gets the RecommendationMetadatasClient object to access its operations. + * Gets the ResourceProvidersClient object to access its operations. * - * @return the RecommendationMetadatasClient object. + * @return the ResourceProvidersClient object. */ - public RecommendationMetadatasClient getRecommendationMetadatas() { - return this.recommendationMetadatas; + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; } /** - * The ConfigurationsClient object to access its operations. + * The OperationsClient object to access its operations. */ - private final ConfigurationsClient configurations; + private final OperationsClient operations; /** - * Gets the ConfigurationsClient object to access its operations. + * Gets the OperationsClient object to access its operations. * - * @return the ConfigurationsClient object. + * @return the OperationsClient object. */ - public ConfigurationsClient getConfigurations() { - return this.configurations; + public OperationsClient getOperations() { + return this.operations; } /** - * The RecommendationsClient object to access its operations. + * The RecommendationMetadatasClient object to access its operations. */ - private final RecommendationsClient recommendations; + private final RecommendationMetadatasClient recommendationMetadatas; /** - * Gets the RecommendationsClient object to access its operations. + * Gets the RecommendationMetadatasClient object to access its operations. * - * @return the RecommendationsClient object. + * @return the RecommendationMetadatasClient object. */ - public RecommendationsClient getRecommendations() { - return this.recommendations; + public RecommendationMetadatasClient getRecommendationMetadatas() { + return this.recommendationMetadatas; } /** - * The OperationsClient object to access its operations. + * The RecommendationsClient object to access its operations. */ - private final OperationsClient operations; + private final RecommendationsClient recommendations; /** - * Gets the OperationsClient object to access its operations. + * Gets the RecommendationsClient object to access its operations. * - * @return the OperationsClient object. + * @return the RecommendationsClient object. */ - public OperationsClient getOperations() { - return this.operations; + public RecommendationsClient getRecommendations() { + return this.recommendations; } /** @@ -197,6 +206,90 @@ public SuppressionsClient getSuppressions() { return this.suppressions; } + /** + * The AdvisorScoresClient object to access its operations. + */ + private final AdvisorScoresClient advisorScores; + + /** + * Gets the AdvisorScoresClient object to access its operations. + * + * @return the AdvisorScoresClient object. + */ + public AdvisorScoresClient getAdvisorScores() { + return this.advisorScores; + } + + /** + * The AssessmentsClient object to access its operations. + */ + private final AssessmentsClient assessments; + + /** + * Gets the AssessmentsClient object to access its operations. + * + * @return the AssessmentsClient object. + */ + public AssessmentsClient getAssessments() { + return this.assessments; + } + + /** + * The ResiliencyReviewsClient object to access its operations. + */ + private final ResiliencyReviewsClient resiliencyReviews; + + /** + * Gets the ResiliencyReviewsClient object to access its operations. + * + * @return the ResiliencyReviewsClient object. + */ + public ResiliencyReviewsClient getResiliencyReviews() { + return this.resiliencyReviews; + } + + /** + * The ConfigurationsClient object to access its operations. + */ + private final ConfigurationsClient configurations; + + /** + * Gets the ConfigurationsClient object to access its operations. + * + * @return the ConfigurationsClient object. + */ + public ConfigurationsClient getConfigurations() { + return this.configurations; + } + + /** + * The AssessmentTypesClient object to access its operations. + */ + private final AssessmentTypesClient assessmentTypes; + + /** + * Gets the AssessmentTypesClient object to access its operations. + * + * @return the AssessmentTypesClient object. + */ + public AssessmentTypesClient getAssessmentTypes() { + return this.assessmentTypes; + } + + /** + * The WorkloadsClient object to access its operations. + */ + private final WorkloadsClient workloads; + + /** + * Gets the WorkloadsClient object to access its operations. + * + * @return the WorkloadsClient object. + */ + public WorkloadsClient getWorkloads() { + return this.workloads; + } + /** * Initializes an instance of AdvisorManagementClient client. * @@ -204,22 +297,28 @@ public SuppressionsClient getSuppressions() { * @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 subscriptionId The Azure subscription ID. - * @param endpoint server parameter. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. */ AdvisorManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; - this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2020-01-01"; + this.subscriptionId = subscriptionId; + this.apiVersion = "2026-08-01-preview"; + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.operations = new OperationsClientImpl(this); this.recommendationMetadatas = new RecommendationMetadatasClientImpl(this); - this.configurations = new ConfigurationsClientImpl(this); this.recommendations = new RecommendationsClientImpl(this); - this.operations = new OperationsClientImpl(this); this.suppressions = new SuppressionsClientImpl(this); + this.advisorScores = new AdvisorScoresClientImpl(this); + this.assessments = new AssessmentsClientImpl(this); + this.resiliencyReviews = new ResiliencyReviewsClientImpl(this); + this.configurations = new ConfigurationsClientImpl(this); + this.assessmentTypes = new AssessmentTypesClientImpl(this); + this.workloads = new WorkloadsClientImpl(this); } /** @@ -259,6 +358,23 @@ public PollerFlux, U> getLroResult(Mono type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + /** * Gets the final result, or an error, based on last async poll response. * @@ -316,7 +432,7 @@ private static final class HttpResponseImpl extends HttpResponse { super(null); this.statusCode = statusCode; this.httpHeaders = httpHeaders; - this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + this.responseBody = responseBody == null ? new byte[0] : responseBody.getBytes(StandardCharsets.UTF_8); } public int getStatusCode() { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoreEntityImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoreEntityImpl.java new file mode 100644 index 0000000000000..cc2bba4e4d1f5 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoreEntityImpl.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.advisor.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner; +import com.azure.resourcemanager.advisor.models.AdvisorScoreEntity; +import com.azure.resourcemanager.advisor.models.ScoreEntity; +import com.azure.resourcemanager.advisor.models.TimeSeriesEntity; +import java.util.Collections; +import java.util.List; + +public final class AdvisorScoreEntityImpl implements AdvisorScoreEntity { + private AdvisorScoreEntityInner innerObject; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + AdvisorScoreEntityImpl(AdvisorScoreEntityInner innerObject, + com.azure.resourcemanager.advisor.AdvisorManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public ScoreEntity lastRefreshedScore() { + return this.innerModel().lastRefreshedScore(); + } + + public List timeSeries() { + List inner = this.innerModel().timeSeries(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public AdvisorScoreEntityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java new file mode 100644 index 0000000000000..036f6a7fe50fe --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.fluent.AdvisorScoresClient; +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner; +import com.azure.resourcemanager.advisor.implementation.models.AdvisorScoreResponse; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AdvisorScoresClient. + */ +public final class AdvisorScoresClientImpl implements AdvisorScoresClient { + /** + * The proxy service used to perform REST calls. + */ + private final AdvisorScoresService service; + + /** + * The service client containing this operation class. + */ + private final AdvisorManagementClientImpl client; + + /** + * Initializes an instance of AdvisorScoresClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AdvisorScoresClientImpl(AdvisorManagementClientImpl client) { + this.service + = RestProxy.create(AdvisorScoresService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdvisorManagementClientAdvisorScores to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdvisorManagementClientAdvisorScores") + public interface AdvisorScoresService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/advisorScore/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("name") String name, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/advisorScore/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("name") String name, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/advisorScore") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/advisorScore") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the advisor score. + * + * @param name The scope of Advisor score entity. + * @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 advisor score along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String name) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the advisor score. + * + * @param name The scope of Advisor score entity. + * @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 advisor score on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String name) { + return getWithResponseAsync(name).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the advisor score. + * + * @param name The scope of Advisor score entity. + * @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 advisor score along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String name, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + name, accept, context); + } + + /** + * Gets the advisor score. + * + * @param name The scope of Advisor score entity. + * @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 advisor score. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvisorScoreEntityInner get(String name) { + return getWithResponse(name, Context.NONE).getValue(); + } + + /** + * Gets the list of advisor scores. + * + * @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 list of advisor scores along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the list of advisor scores. + * + * @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 list of advisor scores as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Gets the list of advisor scores. + * + * @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 list of advisor scores along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + null, null); + } + + /** + * Gets the list of advisor scores. + * + * @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 list of advisor scores along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + null, null); + } + + /** + * Gets the list of advisor scores. + * + * @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 list of advisor scores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage()); + } + + /** + * Gets the list of advisor scores. + * + * @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 list of advisor scores as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context)); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.java new file mode 100644 index 0000000000000..a8948004db8de --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.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.advisor.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.advisor.fluent.AdvisorScoresClient; +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner; +import com.azure.resourcemanager.advisor.models.AdvisorScoreEntity; +import com.azure.resourcemanager.advisor.models.AdvisorScores; + +public final class AdvisorScoresImpl implements AdvisorScores { + private static final ClientLogger LOGGER = new ClientLogger(AdvisorScoresImpl.class); + + private final AdvisorScoresClient innerClient; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + public AdvisorScoresImpl(AdvisorScoresClient innerClient, + com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String name, Context context) { + Response inner = this.serviceClient().getWithResponse(name, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AdvisorScoreEntityImpl(inner.getValue(), this.manager())); + } + + public AdvisorScoreEntity get(String name) { + AdvisorScoreEntityInner inner = this.serviceClient().get(name); + if (inner != null) { + return new AdvisorScoreEntityImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AdvisorScoreEntityImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AdvisorScoreEntityImpl(inner1, this.manager())); + } + + private AdvisorScoresClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentResultImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentResultImpl.java new file mode 100644 index 0000000000000..9ed17d7e93c6c --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentResultImpl.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.advisor.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.advisor.fluent.models.AssessmentResultInner; +import com.azure.resourcemanager.advisor.models.AssessmentResult; + +public final class AssessmentResultImpl + implements AssessmentResult, AssessmentResult.Definition, AssessmentResult.Update { + private AssessmentResultInner innerObject; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String workloadId() { + return this.innerModel().workloadId(); + } + + public String workloadName() { + return this.innerModel().workloadName(); + } + + public String assessmentId() { + return this.innerModel().assessmentId(); + } + + public String description() { + return this.innerModel().description(); + } + + public String typeId() { + return this.innerModel().typeId(); + } + + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public Integer score() { + return this.innerModel().score(); + } + + public String state() { + return this.innerModel().state(); + } + + public String typeVersion() { + return this.innerModel().typeVersion(); + } + + public String locale() { + return this.innerModel().locale(); + } + + public AssessmentResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } + + private String assessmentName; + + public AssessmentResult create() { + this.innerObject = serviceManager.serviceClient() + .getAssessments() + .putWithResponse(assessmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AssessmentResult create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAssessments() + .putWithResponse(assessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + AssessmentResultImpl(String name, com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerObject = new AssessmentResultInner(); + this.serviceManager = serviceManager; + this.assessmentName = name; + } + + public AssessmentResultImpl update() { + return this; + } + + public AssessmentResult apply() { + this.innerObject = serviceManager.serviceClient() + .getAssessments() + .putWithResponse(assessmentName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AssessmentResult apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAssessments() + .putWithResponse(assessmentName, this.innerModel(), context) + .getValue(); + return this; + } + + AssessmentResultImpl(AssessmentResultInner innerObject, + com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.assessmentName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "assessments"); + } + + public AssessmentResult refresh() { + this.innerObject + = serviceManager.serviceClient().getAssessments().getWithResponse(assessmentName, Context.NONE).getValue(); + return this; + } + + public AssessmentResult refresh(Context context) { + this.innerObject + = serviceManager.serviceClient().getAssessments().getWithResponse(assessmentName, context).getValue(); + return this; + } + + public AssessmentResultImpl withWorkloadId(String workloadId) { + this.innerModel().withWorkloadId(workloadId); + return this; + } + + public AssessmentResultImpl withTypeId(String typeId) { + this.innerModel().withTypeId(typeId); + return this; + } + + public AssessmentResultImpl withLocale(String locale) { + this.innerModel().withLocale(locale); + return this; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypeResultImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypeResultImpl.java new file mode 100644 index 0000000000000..47e971f5d6efe --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypeResultImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.implementation; + +import com.azure.resourcemanager.advisor.fluent.models.AssessmentTypeResultInner; +import com.azure.resourcemanager.advisor.models.AssessmentTypeResult; + +public final class AssessmentTypeResultImpl implements AssessmentTypeResult { + private AssessmentTypeResultInner innerObject; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + AssessmentTypeResultImpl(AssessmentTypeResultInner innerObject, + com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String title() { + return this.innerModel().title(); + } + + public String description() { + return this.innerModel().description(); + } + + public String locale() { + return this.innerModel().locale(); + } + + public String version() { + return this.innerModel().version(); + } + + public AssessmentTypeResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesClientImpl.java new file mode 100644 index 0000000000000..52442485f8d72 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesClientImpl.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.fluent.AssessmentTypesClient; +import com.azure.resourcemanager.advisor.fluent.models.AssessmentTypeResultInner; +import com.azure.resourcemanager.advisor.implementation.models.AssessmentTypeListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AssessmentTypesClient. + */ +public final class AssessmentTypesClientImpl implements AssessmentTypesClient { + /** + * The proxy service used to perform REST calls. + */ + private final AssessmentTypesService service; + + /** + * The service client containing this operation class. + */ + private final AdvisorManagementClientImpl client; + + /** + * Initializes an instance of AssessmentTypesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AssessmentTypesClientImpl(AdvisorManagementClientImpl client) { + this.service + = RestProxy.create(AssessmentTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdvisorManagementClientAssessmentTypes to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdvisorManagementClientAssessmentTypes") + public interface AssessmentTypesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessmentTypes") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessmentTypes") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get assessment types list. + * + * Get list of Azure Advisor assessment types. + * + * @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 assessment types list. + * + * Get list of Azure Advisor assessment types along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), 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 assessment types list. + * + * Get list of Azure Advisor assessment types. + * + * @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 assessment types list. + * + * Get list of Azure Advisor assessment types as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get assessment types list. + * + * Get list of Azure Advisor assessment types. + * + * @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 assessment types list. + * + * Get list of Azure Advisor assessment types along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get assessment types list. + * + * Get list of Azure Advisor assessment types. + * + * @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 assessment types list. + * + * Get list of Azure Advisor assessment types along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get assessment types list. + * + * Get list of Azure Advisor assessment types. + * + * @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 assessment types list. + * + * Get list of Azure Advisor assessment types as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Get assessment types list. + * + * Get list of Azure Advisor assessment types. + * + * @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 assessment types list. + * + * Get list of Azure Advisor assessment types as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get assessment types list. + * + * 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 assessment types list. + * + * Get list of Azure Advisor assessment types along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + 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 assessment types list. + * + * 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 assessment types list. + * + * Get list of Azure Advisor assessment types along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get assessment types list. + * + * 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 assessment types list. + * + * Get list of Azure Advisor assessment types along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesImpl.java new file mode 100644 index 0000000000000..11ea4cadaa49b --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesImpl.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.advisor.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.advisor.fluent.AssessmentTypesClient; +import com.azure.resourcemanager.advisor.fluent.models.AssessmentTypeResultInner; +import com.azure.resourcemanager.advisor.models.AssessmentTypeResult; +import com.azure.resourcemanager.advisor.models.AssessmentTypes; + +public final class AssessmentTypesImpl implements AssessmentTypes { + private static final ClientLogger LOGGER = new ClientLogger(AssessmentTypesImpl.class); + + private final AssessmentTypesClient innerClient; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + public AssessmentTypesImpl(AssessmentTypesClient innerClient, + com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AssessmentTypeResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AssessmentTypeResultImpl(inner1, this.manager())); + } + + private AssessmentTypesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsClientImpl.java new file mode 100644 index 0000000000000..6c23fa10b9e8f --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsClientImpl.java @@ -0,0 +1,525 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.advisor.fluent.AssessmentsClient; +import com.azure.resourcemanager.advisor.fluent.models.AssessmentResultInner; +import com.azure.resourcemanager.advisor.implementation.models.AssessmentListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AssessmentsClient. + */ +public final class AssessmentsClientImpl implements AssessmentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final AssessmentsService service; + + /** + * The service client containing this operation class. + */ + private final AdvisorManagementClientImpl client; + + /** + * Initializes an instance of AssessmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AssessmentsClientImpl(AdvisorManagementClientImpl client) { + this.service + = RestProxy.create(AssessmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdvisorManagementClientAssessments to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdvisorManagementClientAssessments") + public interface AssessmentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments/{assessmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("assessmentName") String assessmentName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments/{assessmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("assessmentName") String assessmentName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments/{assessmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> put(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("assessmentName") String assessmentName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") AssessmentResultInner assessmentContract, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments/{assessmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response putSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("assessmentName") String assessmentName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") AssessmentResultInner assessmentContract, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments/{assessmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("assessmentName") String assessmentName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments/{assessmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, @PathParam("assessmentName") String assessmentName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") String top, @QueryParam("$skiptoken") String skiptoken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") String top, @QueryParam("$skiptoken") String skiptoken, + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 an existing Azure Advisor assessment along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String assessmentName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), assessmentName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 an existing Azure Advisor assessment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String assessmentName) { + return getWithResponseAsync(assessmentName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 an existing Azure Advisor assessment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String assessmentName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + assessmentName, accept, context); + } + + /** + * Get an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 an existing Azure Advisor assessment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AssessmentResultInner get(String assessmentName) { + return getWithResponse(assessmentName, Context.NONE).getValue(); + } + + /** + * Create or Overwrite Azure Advisor assessment. + * + * @param assessmentName Advisor assessment name. + * @param assessmentContract The Azure Advisor assessment data structure. + * @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 Advisor assessment result data structure along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync(String assessmentName, + AssessmentResultInner assessmentContract) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.put(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), assessmentName, contentType, accept, assessmentContract, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or Overwrite Azure Advisor assessment. + * + * @param assessmentName Advisor assessment name. + * @param assessmentContract The Azure Advisor assessment data structure. + * @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 Advisor assessment result data structure on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync(String assessmentName, AssessmentResultInner assessmentContract) { + return putWithResponseAsync(assessmentName, assessmentContract) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or Overwrite Azure Advisor assessment. + * + * @param assessmentName Advisor assessment name. + * @param assessmentContract The Azure Advisor assessment data structure. + * @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 Advisor assessment result data structure along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse(String assessmentName, + AssessmentResultInner assessmentContract, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.putSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + assessmentName, contentType, accept, assessmentContract, context); + } + + /** + * Create or Overwrite Azure Advisor assessment. + * + * @param assessmentName Advisor assessment name. + * @param assessmentContract The Azure Advisor assessment data structure. + * @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 Advisor assessment result data structure. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AssessmentResultInner put(String assessmentName, AssessmentResultInner assessmentContract) { + return putWithResponse(assessmentName, assessmentContract, Context.NONE).getValue(); + } + + /** + * Delete an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 assessmentName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), assessmentName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 assessmentName) { + return deleteWithResponseAsync(assessmentName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 assessmentName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), assessmentName, context); + } + + /** + * Delete an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 assessmentName) { + deleteWithResponse(assessmentName, Context.NONE); + } + + /** + * Get list of Azure Advisor assessments. + * + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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 list of Azure Advisor assessments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String top, String skiptoken) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), top, skiptoken, 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 list of Azure Advisor assessments. + * + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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 list of Azure Advisor assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String top, String skiptoken) { + return new PagedFlux<>(() -> listSinglePageAsync(top, skiptoken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get list of Azure Advisor assessments. + * + * @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 list of Azure Advisor assessments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String top = null; + final String skiptoken = null; + return new PagedFlux<>(() -> listSinglePageAsync(top, skiptoken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get list of Azure Advisor assessments. + * + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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 list of Azure Advisor assessments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String top, String skiptoken) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), top, skiptoken, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get list of Azure Advisor assessments. + * + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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 list of Azure Advisor assessments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String top, String skiptoken, Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), top, skiptoken, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get list of Azure Advisor assessments. + * + * @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 list of Azure Advisor assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String top = null; + final String skiptoken = null; + return new PagedIterable<>(() -> listSinglePage(top, skiptoken), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Get list of Azure Advisor assessments. + * + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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 list of Azure Advisor assessments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String top, String skiptoken, Context context) { + return new PagedIterable<>(() -> listSinglePage(top, skiptoken, context), + nextLink -> listNextSinglePage(nextLink, 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 list of Azure Advisor assessments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + 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. + * @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 list of Azure Advisor assessments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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 list of Azure Advisor assessments along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsImpl.java new file mode 100644 index 0000000000000..a3a9da7162c65 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsImpl.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.fluent.AssessmentsClient; +import com.azure.resourcemanager.advisor.fluent.models.AssessmentResultInner; +import com.azure.resourcemanager.advisor.models.AssessmentResult; +import com.azure.resourcemanager.advisor.models.Assessments; + +public final class AssessmentsImpl implements Assessments { + private static final ClientLogger LOGGER = new ClientLogger(AssessmentsImpl.class); + + private final AssessmentsClient innerClient; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + public AssessmentsImpl(AssessmentsClient innerClient, + com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String assessmentName, Context context) { + Response inner = this.serviceClient().getWithResponse(assessmentName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AssessmentResultImpl(inner.getValue(), this.manager())); + } + + public AssessmentResult get(String assessmentName) { + AssessmentResultInner inner = this.serviceClient().get(assessmentName); + if (inner != null) { + return new AssessmentResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String assessmentName, Context context) { + return this.serviceClient().deleteWithResponse(assessmentName, context); + } + + public void delete(String assessmentName) { + this.serviceClient().delete(assessmentName); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AssessmentResultImpl(inner1, this.manager())); + } + + public PagedIterable list(String top, String skiptoken, Context context) { + PagedIterable inner = this.serviceClient().list(top, skiptoken, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AssessmentResultImpl(inner1, this.manager())); + } + + public AssessmentResult getById(String id) { + String assessmentName = ResourceManagerUtils.getValueFromIdByName(id, "assessments"); + if (assessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + return this.getWithResponse(assessmentName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String assessmentName = ResourceManagerUtils.getValueFromIdByName(id, "assessments"); + if (assessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + return this.getWithResponse(assessmentName, context); + } + + public void deleteById(String id) { + String assessmentName = ResourceManagerUtils.getValueFromIdByName(id, "assessments"); + if (assessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + this.deleteWithResponse(assessmentName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String assessmentName = ResourceManagerUtils.getValueFromIdByName(id, "assessments"); + if (assessmentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); + } + return this.deleteWithResponse(assessmentName, context); + } + + private AssessmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } + + public AssessmentResultImpl define(String name) { + return new AssessmentResultImpl(name, this.manager()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java index 2545ec4fc9cef..266cebf0d9453 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java @@ -1,15 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.advisor.fluent.models.ConfigDataInner; import com.azure.resourcemanager.advisor.models.ConfigData; import com.azure.resourcemanager.advisor.models.ConfigurationName; import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfig; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.util.Collections; import java.util.List; @@ -35,6 +37,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public Boolean exclude() { return this.innerModel().exclude(); } @@ -43,6 +49,10 @@ public CpuThreshold lowCpuThreshold() { return this.innerModel().lowCpuThreshold(); } + public DurationModel duration() { + return this.innerModel().duration(); + } + public List digests() { List inner = this.innerModel().digests(); if (inner != null) { @@ -101,6 +111,11 @@ public ConfigDataImpl withLowCpuThreshold(CpuThreshold lowCpuThreshold) { return this; } + public ConfigDataImpl withDuration(DurationModel duration) { + this.innerModel().withDuration(duration); + return this; + } + public ConfigDataImpl withDigests(List digests) { this.innerModel().withDigests(digests); return this; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsClientImpl.java index 2cde27c36f04e..1322a81bc798f 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; @@ -29,7 +29,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.advisor.fluent.ConfigurationsClient; import com.azure.resourcemanager.advisor.fluent.models.ConfigDataInner; -import com.azure.resourcemanager.advisor.models.ConfigurationListResult; +import com.azure.resourcemanager.advisor.implementation.models.ConfigurationListResult; import com.azure.resourcemanager.advisor.models.ConfigurationName; import reactor.core.publisher.Mono; @@ -62,44 +62,77 @@ public final class ConfigurationsClientImpl implements ConfigurationsClient { * The interface defining all the services for AdvisorManagementClientConfigurations to be used by the proxy service * to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "AdvisorManagementCli") + @Host("{endpoint}") + @ServiceInterface(name = "AdvisorManagementClientConfigurations") public interface ConfigurationsService { @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createInSubscription(@HostParam("$host") String endpoint, + Mono> createInSubscription(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("configurationName") ConfigurationName configurationName, - @BodyParam("application/json") ConfigDataInner configContract, @HeaderParam("Accept") String accept, - Context context); + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ConfigDataInner configContract, Context context); + + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createInSubscriptionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("configurationName") ConfigurationName configurationName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ConfigDataInner configContract, Context context); @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroup(@HostParam("$host") String endpoint, + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroup") String resourceGroup, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroup") String resourceGroup, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createInResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("configurationName") ConfigurationName configurationName, + @PathParam("resourceGroup") String resourceGroup, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ConfigDataInner configContract, + Context context); + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createInResourceGroup(@HostParam("$host") String endpoint, + Response createInResourceGroupSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("configurationName") ConfigurationName configurationName, - @PathParam("resourceGroup") String resourceGroup, - @BodyParam("application/json") ConfigDataInner configContract, @HeaderParam("Accept") String accept, + @PathParam("resourceGroup") String resourceGroup, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ConfigDataInner configContract, Context context); @Headers({ "Content-Type: application/json" }) @@ -107,7 +140,31 @@ Mono> createInResourceGroup(@HostParam("$host") String @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listBySubscriptionNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } @@ -118,19 +175,11 @@ Mono> listBySubscriptionNext( * * @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 list of Advisor configurations along with {@link PagedResponse} on successful completion of + * @return paged collection of ConfigData items 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.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), @@ -145,30 +194,14 @@ private Mono> listSinglePageAsync() { * * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. * - * @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 list of Advisor configurations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return paged collection of ConfigData items as paginated response with {@link PagedFlux}. */ - @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.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono.error(new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, - context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); } /** @@ -178,12 +211,15 @@ private Mono> listSinglePageAsync(Context context * * @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 list of Advisor configurations as paginated response with {@link PagedFlux}. + * @return paged collection of ConfigData items along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -195,12 +231,15 @@ private PagedFlux listAsync() { * @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 list of Advisor configurations as paginated response with {@link PagedFlux}. + * @return paged collection of ConfigData items along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -210,11 +249,11 @@ private PagedFlux listAsync(Context context) { * * @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 list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); } /** @@ -226,11 +265,12 @@ public PagedIterable list() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); } /** @@ -249,70 +289,14 @@ public PagedIterable list(Context context) { @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createInSubscriptionWithResponseAsync(ConfigurationName configurationName, ConfigDataInner configContract) { - 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 (configurationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); - } - if (configContract == null) { - return Mono.error(new IllegalArgumentException("Parameter configContract is required and cannot be null.")); - } else { - configContract.validate(); - } + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil .withContext(context -> service.createInSubscription(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), configurationName, configContract, accept, context)) + this.client.getSubscriptionId(), configurationName, contentType, accept, configContract, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Create/Overwrite Azure Advisor configuration. - * - * Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. - * - * @param configurationName Advisor configuration name. Value must be 'default'. - * @param configContract The Azure Advisor configuration data structure. - * @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 Advisor configuration data structure along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createInSubscriptionWithResponseAsync(ConfigurationName configurationName, - ConfigDataInner configContract, 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 (configurationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); - } - if (configContract == null) { - return Mono.error(new IllegalArgumentException("Parameter configContract is required and cannot be null.")); - } else { - configContract.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createInSubscription(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), configurationName, configContract, accept, context); - } - /** * Create/Overwrite Azure Advisor configuration. * @@ -348,7 +332,10 @@ private Mono createInSubscriptionAsync(ConfigurationName config @ServiceMethod(returns = ReturnType.SINGLE) public Response createInSubscriptionWithResponse(ConfigurationName configurationName, ConfigDataInner configContract, Context context) { - return createInSubscriptionWithResponseAsync(configurationName, configContract, context).block(); + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createInSubscriptionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), configurationName, contentType, accept, configContract, context); } /** @@ -375,28 +362,17 @@ public ConfigDataInner createInSubscription(ConfigurationName configurationName, * @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 list of Advisor configurations along with {@link PagedResponse} on successful completion of + * @return paged collection of ConfigData items along with {@link PagedResponse} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync(String resourceGroup) { - 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 (resourceGroup == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroup, accept, context)) .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), - res.getHeaders(), res.getValue().value(), null, null)) + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -404,34 +380,15 @@ private Mono> listByResourceGroupSinglePageAsync( * Retrieve Azure Advisor configurations. * * @param resourceGroup The name of the Azure resource group. - * @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 list of Advisor configurations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return paged collection of ConfigData items as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupSinglePageAsync(String resourceGroup, - 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 (resourceGroup == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), resourceGroup, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), null, null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroup) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroup), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); } /** @@ -441,11 +398,15 @@ private Mono> listByResourceGroupSinglePageAsync( * @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 list of Advisor configurations as paginated response with {@link PagedFlux}. + * @return paged collection of ConfigData items along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroup) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroup)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroup) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroup, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -456,11 +417,15 @@ private PagedFlux listByResourceGroupAsync(String resourceGroup * @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 list of Advisor configurations as paginated response with {@link PagedFlux}. + * @return paged collection of ConfigData items along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroup, Context context) { - return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroup, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroup, Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroup, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -470,11 +435,12 @@ private PagedFlux listByResourceGroupAsync(String resourceGroup * @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 list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroup) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroup)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroup), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); } /** @@ -485,11 +451,12 @@ public PagedIterable listByResourceGroup(String resourceGroup) * @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 list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroup, Context context) { - return new PagedIterable<>(listByResourceGroupAsync(resourceGroup, context)); + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroup, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); } /** @@ -507,76 +474,15 @@ public PagedIterable listByResourceGroup(String resourceGroup, @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createInResourceGroupWithResponseAsync(ConfigurationName configurationName, String resourceGroup, ConfigDataInner configContract) { - 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 (configurationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); - } - if (resourceGroup == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); - } - if (configContract == null) { - return Mono.error(new IllegalArgumentException("Parameter configContract is required and cannot be null.")); - } else { - configContract.validate(); - } + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.createInResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), configurationName, resourceGroup, configContract, accept, context)) + .withContext(context -> service.createInResourceGroup(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), configurationName, resourceGroup, + contentType, accept, configContract, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Create/Overwrite Azure Advisor configuration. - * - * @param configurationName Advisor configuration name. Value must be 'default'. - * @param resourceGroup The name of the Azure resource group. - * @param configContract The Azure Advisor configuration data structure. - * @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 Advisor configuration data structure along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createInResourceGroupWithResponseAsync(ConfigurationName configurationName, - String resourceGroup, ConfigDataInner configContract, 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 (configurationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); - } - if (resourceGroup == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); - } - if (configContract == null) { - return Mono.error(new IllegalArgumentException("Parameter configContract is required and cannot be null.")); - } else { - configContract.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createInResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), configurationName, resourceGroup, configContract, accept, context); - } - /** * Create/Overwrite Azure Advisor configuration. * @@ -610,8 +516,11 @@ private Mono createInResourceGroupAsync(ConfigurationName confi @ServiceMethod(returns = ReturnType.SINGLE) public Response createInResourceGroupWithResponse(ConfigurationName configurationName, String resourceGroup, ConfigDataInner configContract, Context context) { - return createInResourceGroupWithResponseAsync(configurationName, resourceGroup, configContract, context) - .block(); + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createInResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), configurationName, resourceGroup, contentType, accept, configContract, + context); } /** @@ -633,24 +542,19 @@ public ConfigDataInner createInResourceGroup(ConfigurationName configurationName } /** + * Retrieve Azure Advisor configurations. + * * 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 list of Advisor configurations along with {@link PagedResponse} on successful completion of + * @return paged collection of ConfigData items along with {@link PagedResponse} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBySubscriptionNextSinglePageAsync(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( @@ -661,6 +565,28 @@ private Mono> listBySubscriptionNextSinglePageAsy } /** + * Retrieve Azure Advisor configurations. + * + * 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 paged collection of ConfigData items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Retrieve Azure Advisor configurations. + * * Get the next page of items. * * @param nextLink The URL to get the next list of items. @@ -668,23 +594,78 @@ private Mono> listBySubscriptionNextSinglePageAsy * @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 list of Advisor configurations along with {@link PagedResponse} on successful completion of + * @return paged collection of ConfigData items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Retrieve Azure Advisor configurations. + * + * 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 paged collection of ConfigData items along with {@link PagedResponse} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySubscriptionNextSinglePageAsync(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.")); - } + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(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())); + } + + /** + * Retrieve Azure Advisor configurations. + * + * 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 paged collection of ConfigData items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Retrieve Azure Advisor configurations. + * + * 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 paged collection of ConfigData items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsImpl.java index 4c17cca891a49..4826376d61935 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; @@ -42,12 +42,8 @@ public Response createInSubscriptionWithResponse(ConfigurationName c ConfigDataInner configContract, Context context) { Response inner = this.serviceClient().createInSubscriptionWithResponse(configurationName, configContract, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ConfigDataImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ConfigDataImpl(inner.getValue(), this.manager())); } public ConfigData createInSubscription(ConfigurationName configurationName, ConfigDataInner configContract) { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/MetadataEntityImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/MetadataEntityImpl.java index 4b6d8895bed07..b29f60a966c04 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/MetadataEntityImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/MetadataEntityImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.advisor.fluent.models.MetadataEntityInner; import com.azure.resourcemanager.advisor.models.MetadataEntity; import com.azure.resourcemanager.advisor.models.MetadataSupportedValueDetail; @@ -26,12 +27,16 @@ public String id() { return this.innerModel().id(); } + public String name() { + return this.innerModel().name(); + } + public String type() { return this.innerModel().type(); } - public String name() { - return this.innerModel().name(); + public SystemData systemData() { + return this.innerModel().systemData(); } public String displayName() { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationEntityImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationEntityImpl.java index 5448a683f797a..0e22d24931477 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationEntityImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationEntityImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsClientImpl.java index a95dbd3ec500f..dff3d6f1e044b 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.advisor.fluent.OperationsClient; import com.azure.resourcemanager.advisor.fluent.models.OperationEntityInner; -import com.azure.resourcemanager.advisor.models.OperationEntityListResult; +import com.azure.resourcemanager.advisor.implementation.models.OperationEntityListResult; import reactor.core.publisher.Mono; /** @@ -59,14 +59,21 @@ public final class OperationsClientImpl implements OperationsClient { * The interface defining all the services for AdvisorManagementClientOperations to be used by the proxy service to * perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "AdvisorManagementCli") + @Host("{endpoint}") + @ServiceInterface(name = "AdvisorManagementClientOperations") public interface OperationsService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Advisor/operations") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Advisor/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @@ -74,23 +81,27 @@ Mono> list(@HostParam("$host") String endpoi @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Lists all the available Advisor REST API operations. + * 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 the list of Advisor operations along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return paged collection of OperationEntity items 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( @@ -101,78 +112,75 @@ private Mono> listSinglePageAsync() { } /** - * Lists all the available Advisor REST API operations. + * 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 the list of Advisor operations along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return paged collection of OperationEntity items as paginated response with {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** - * Lists all the available Advisor REST API operations. + * 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 the list of Advisor operations as paginated response with {@link PagedFlux}. + * @return paged collection of OperationEntity items along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Lists all the available Advisor REST API operations. + * 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 the list of Advisor operations as paginated response with {@link PagedFlux}. + * @return paged collection of OperationEntity items along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Lists all the available Advisor REST API operations. + * 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 the list of Advisor operations as paginated response with {@link PagedIterable}. + * @return paged collection of OperationEntity items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** - * Lists all the available Advisor REST API operations. + * 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 the list of Advisor operations as paginated response with {@link PagedIterable}. + * @return paged collection of OperationEntity items as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -182,17 +190,11 @@ public PagedIterable list(Context context) { * @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 list of Advisor operations along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return paged collection of OperationEntity items 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(), @@ -200,6 +202,24 @@ private Mono> listNextSinglePageAsync(String .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. + * @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 paged collection of OperationEntity items along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -208,21 +228,14 @@ private Mono> listNextSinglePageAsync(String * @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 list of Advisor operations along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return paged collection of OperationEntity items along with {@link PagedResponse}. */ @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.")); - } + private PagedResponse listNextSinglePage(String nextLink, Context context) { 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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsImpl.java index 1d6d7a8458d03..1cdd7626debad 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/PredictionResponseImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/PredictionResponseImpl.java new file mode 100644 index 0000000000000..1ed5d4ccab627 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/PredictionResponseImpl.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.advisor.implementation; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.PredictionResponseInner; +import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.PredictionResponse; +import com.azure.resourcemanager.advisor.models.PredictionType; +import com.azure.resourcemanager.advisor.models.ShortDescription; +import java.time.OffsetDateTime; + +public final class PredictionResponseImpl implements PredictionResponse { + private PredictionResponseInner innerObject; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + PredictionResponseImpl(PredictionResponseInner innerObject, + com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public BinaryData extendedProperties() { + return this.innerModel().extendedProperties(); + } + + public PredictionType predictionType() { + return this.innerModel().predictionType(); + } + + public Category category() { + return this.innerModel().category(); + } + + public Impact impact() { + return this.innerModel().impact(); + } + + public String impactedField() { + return this.innerModel().impactedField(); + } + + public OffsetDateTime lastUpdated() { + return this.innerModel().lastUpdated(); + } + + public ShortDescription shortDescription() { + return this.innerModel().shortDescription(); + } + + public PredictionResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasClientImpl.java index a2c1a0ad55df8..8ace9830393aa 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; @@ -27,7 +27,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient; import com.azure.resourcemanager.advisor.fluent.models.MetadataEntityInner; -import com.azure.resourcemanager.advisor.models.MetadataEntityListResult; +import com.azure.resourcemanager.advisor.implementation.models.MetadataEntityListResult; import reactor.core.publisher.Mono; /** @@ -59,31 +59,57 @@ public final class RecommendationMetadatasClientImpl implements RecommendationMe * The interface defining all the services for AdvisorManagementClientRecommendationMetadatas to be used by the * proxy service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "AdvisorManagementCli") + @Host("{endpoint}") + @ServiceInterface(name = "AdvisorManagementClientRecommendationMetadatas") public interface RecommendationMetadatasService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Advisor/metadata/{name}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ManagementException.class, code = { 404 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, @PathParam("name") String name, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Advisor/metadata/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ManagementException.class, code = { 404 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("name") String name, + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Advisor/metadata") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Advisor/metadata") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -98,45 +124,13 @@ Mono> listNext( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String name) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (name == null) { - return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil .withContext( - context -> service.get(this.client.getEndpoint(), name, this.client.getApiVersion(), accept, context)) + context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), name, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets the metadata entity. - * - * @param name Name of metadata entity. - * @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 ManagementException thrown if the request is rejected by server on status code 404. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the metadata entity along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String name, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (name == null) { - return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), name, this.client.getApiVersion(), accept, context); - } - /** * Gets the metadata entity. * @@ -165,7 +159,8 @@ private Mono getAsync(String name) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String name, Context context) { - return getWithResponseAsync(name, context).block(); + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), name, accept, context); } /** @@ -186,20 +181,30 @@ public MetadataEntityInner get(String name) { /** * Gets the list of metadata entities. * + * @param filter The filter to apply to the recommendation metadata.<br>Filter can be applied to properties + * ['[recommendationCategory](#category)', '[recommendationSubCategory](#recommendationSubCategory)', + * 'RetirementDate'] with operators ['eq', 'and', 'le', 'ge']<br>The filter can also be applied to property + * ['[TrackingIds]']<br><br>âš  **Note:** `recommendationControl` is a legacy filter property and will be + * deprecated in the future. Please use `recommendationSubCategory` for filtering recommendation + * subcategory.<br><br>Valid options for recommendationSubCategory: ['BusinessContinuity', + * 'DisasterRecovery', 'HighAvailability', 'MonitoringAndAlerting', 'Other', 'Personalized', + * 'PrioritizedRecommendations', 'Scalability', 'ServiceUpgradeAndRetirement', + * 'Validation']<br><br>Example:<br>- $filter=recommendationCategory eq 'HighAvailability' and + * recommendationSubCategory eq 'ServiceUpgradeAndRetirement' and retirementDate ge '2024-01-01' and retirementDate + * le '2028-01-01'. Filter can be applied on trackingIds as well.<br>- $filter=trackingIds/any(t: t eq + * 'some-guid')<br><br>âš  **Note:** `trackingIDs` filter can be used for filtering one value at a time. + * The support to filter multiple values is not currently available. Also the support to add other filters along + * with `trackingIDs` is not available. + * @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 list of metadata entities 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.")); - } + private Mono> listSinglePageAsync(String filter) { final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + return FluxUtil.withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), filter, 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())); @@ -208,23 +213,28 @@ private Mono> listSinglePageAsync() { /** * Gets the list of metadata entities. * - * @param context The context to associate with this operation. + * @param filter The filter to apply to the recommendation metadata.<br>Filter can be applied to properties + * ['[recommendationCategory](#category)', '[recommendationSubCategory](#recommendationSubCategory)', + * 'RetirementDate'] with operators ['eq', 'and', 'le', 'ge']<br>The filter can also be applied to property + * ['[TrackingIds]']<br><br>âš  **Note:** `recommendationControl` is a legacy filter property and will be + * deprecated in the future. Please use `recommendationSubCategory` for filtering recommendation + * subcategory.<br><br>Valid options for recommendationSubCategory: ['BusinessContinuity', + * 'DisasterRecovery', 'HighAvailability', 'MonitoringAndAlerting', 'Other', 'Personalized', + * 'PrioritizedRecommendations', 'Scalability', 'ServiceUpgradeAndRetirement', + * 'Validation']<br><br>Example:<br>- $filter=recommendationCategory eq 'HighAvailability' and + * recommendationSubCategory eq 'ServiceUpgradeAndRetirement' and retirementDate ge '2024-01-01' and retirementDate + * le '2028-01-01'. Filter can be applied on trackingIds as well.<br>- $filter=trackingIds/any(t: t eq + * 'some-guid')<br><br>âš  **Note:** `trackingIDs` filter can be used for filtering one value at a time. + * The support to filter multiple values is not currently available. Also the support to add other filters along + * with `trackingIDs` is not available. * @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 list of metadata entities along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the list of metadata entities as paginated response with {@link PagedFlux}. */ - @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)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -236,22 +246,71 @@ private Mono> listSinglePageAsync(Context con */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the list of metadata entities. + * + * @param filter The filter to apply to the recommendation metadata.<br>Filter can be applied to properties + * ['[recommendationCategory](#category)', '[recommendationSubCategory](#recommendationSubCategory)', + * 'RetirementDate'] with operators ['eq', 'and', 'le', 'ge']<br>The filter can also be applied to property + * ['[TrackingIds]']<br><br>âš  **Note:** `recommendationControl` is a legacy filter property and will be + * deprecated in the future. Please use `recommendationSubCategory` for filtering recommendation + * subcategory.<br><br>Valid options for recommendationSubCategory: ['BusinessContinuity', + * 'DisasterRecovery', 'HighAvailability', 'MonitoringAndAlerting', 'Other', 'Personalized', + * 'PrioritizedRecommendations', 'Scalability', 'ServiceUpgradeAndRetirement', + * 'Validation']<br><br>Example:<br>- $filter=recommendationCategory eq 'HighAvailability' and + * recommendationSubCategory eq 'ServiceUpgradeAndRetirement' and retirementDate ge '2024-01-01' and retirementDate + * le '2028-01-01'. Filter can be applied on trackingIds as well.<br>- $filter=trackingIds/any(t: t eq + * 'some-guid')<br><br>âš  **Note:** `trackingIDs` filter can be used for filtering one value at a time. + * The support to filter multiple values is not currently available. Also the support to add other filters along + * with `trackingIDs` is not available. + * @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 list of metadata entities along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String filter) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), filter, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** * Gets the list of metadata entities. * + * @param filter The filter to apply to the recommendation metadata.<br>Filter can be applied to properties + * ['[recommendationCategory](#category)', '[recommendationSubCategory](#recommendationSubCategory)', + * 'RetirementDate'] with operators ['eq', 'and', 'le', 'ge']<br>The filter can also be applied to property + * ['[TrackingIds]']<br><br>âš  **Note:** `recommendationControl` is a legacy filter property and will be + * deprecated in the future. Please use `recommendationSubCategory` for filtering recommendation + * subcategory.<br><br>Valid options for recommendationSubCategory: ['BusinessContinuity', + * 'DisasterRecovery', 'HighAvailability', 'MonitoringAndAlerting', 'Other', 'Personalized', + * 'PrioritizedRecommendations', 'Scalability', 'ServiceUpgradeAndRetirement', + * 'Validation']<br><br>Example:<br>- $filter=recommendationCategory eq 'HighAvailability' and + * recommendationSubCategory eq 'ServiceUpgradeAndRetirement' and retirementDate ge '2024-01-01' and retirementDate + * le '2028-01-01'. Filter can be applied on trackingIds as well.<br>- $filter=trackingIds/any(t: t eq + * 'some-guid')<br><br>âš  **Note:** `trackingIDs` filter can be used for filtering one value at a time. + * The support to filter multiple values is not currently available. Also the support to add other filters along + * with `trackingIDs` is not available. * @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 list of metadata entities as paginated response with {@link PagedFlux}. + * @return the list of metadata entities along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String filter, Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), filter, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -263,12 +322,27 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + final String filter = null; + return new PagedIterable<>(() -> listSinglePage(filter), nextLink -> listNextSinglePage(nextLink)); } /** * Gets the list of metadata entities. * + * @param filter The filter to apply to the recommendation metadata.<br>Filter can be applied to properties + * ['[recommendationCategory](#category)', '[recommendationSubCategory](#recommendationSubCategory)', + * 'RetirementDate'] with operators ['eq', 'and', 'le', 'ge']<br>The filter can also be applied to property + * ['[TrackingIds]']<br><br>âš  **Note:** `recommendationControl` is a legacy filter property and will be + * deprecated in the future. Please use `recommendationSubCategory` for filtering recommendation + * subcategory.<br><br>Valid options for recommendationSubCategory: ['BusinessContinuity', + * 'DisasterRecovery', 'HighAvailability', 'MonitoringAndAlerting', 'Other', 'Personalized', + * 'PrioritizedRecommendations', 'Scalability', 'ServiceUpgradeAndRetirement', + * 'Validation']<br><br>Example:<br>- $filter=recommendationCategory eq 'HighAvailability' and + * recommendationSubCategory eq 'ServiceUpgradeAndRetirement' and retirementDate ge '2024-01-01' and retirementDate + * le '2028-01-01'. Filter can be applied on trackingIds as well.<br>- $filter=trackingIds/any(t: t eq + * 'some-guid')<br><br>âš  **Note:** `trackingIDs` filter can be used for filtering one value at a time. + * The support to filter multiple values is not currently available. Also the support to add other filters along + * with `trackingIDs` is not available. * @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. @@ -276,8 +350,9 @@ public PagedIterable list() { * @return the list of metadata entities as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(() -> listSinglePage(filter, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -291,13 +366,6 @@ public PagedIterable list(Context context) { */ @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(), @@ -305,6 +373,24 @@ private Mono> listNextSinglePageAsync(String .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. + * @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 list of metadata entities along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -313,21 +399,14 @@ private Mono> listNextSinglePageAsync(String * @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 list of metadata entities along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the list of metadata entities along with {@link PagedResponse}. */ @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.")); - } + private PagedResponse listNextSinglePage(String nextLink, Context context) { 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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasImpl.java index 342693af0eb1d..de92a04154e5d 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; @@ -29,12 +29,8 @@ public RecommendationMetadatasImpl(RecommendationMetadatasClient innerClient, public Response getWithResponse(String name, Context context) { Response inner = this.serviceClient().getWithResponse(name, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new MetadataEntityImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MetadataEntityImpl(inner.getValue(), this.manager())); } public MetadataEntity get(String name) { @@ -51,8 +47,8 @@ public PagedIterable list() { return ResourceManagerUtils.mapPage(inner, inner1 -> new MetadataEntityImpl(inner1, this.manager())); } - public PagedIterable list(Context context) { - PagedIterable inner = this.serviceClient().list(context); + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); return ResourceManagerUtils.mapPage(inner, inner1 -> new MetadataEntityImpl(inner1, this.manager())); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsClientImpl.java index 45c4dbaf8be22..02fd9bc0ab528 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsClientImpl.java @@ -1,15 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; +import com.azure.core.annotation.BodyParam; 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.Patch; import com.azure.core.annotation.PathParam; import com.azure.core.annotation.Post; import com.azure.core.annotation.QueryParam; @@ -28,9 +30,11 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.advisor.fluent.RecommendationsClient; import com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner; +import com.azure.resourcemanager.advisor.implementation.models.ResourceRecommendationBaseListResult; +import com.azure.resourcemanager.advisor.models.RecommendationListMode; +import com.azure.resourcemanager.advisor.models.RecommendationPatchPayload; import com.azure.resourcemanager.advisor.models.RecommendationsGenerateResponse; -import com.azure.resourcemanager.advisor.models.ResourceRecommendationBaseListResult; -import java.util.UUID; +import com.azure.resourcemanager.advisor.models.RecommendationsGetGenerateStatusResponse; import reactor.core.publisher.Mono; /** @@ -62,100 +66,1135 @@ public final class RecommendationsClientImpl implements RecommendationsClient { * The interface defining all the services for AdvisorManagementClientRecommendations to be used by the proxy * service to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "AdvisorManagementCli") + @Host("{endpoint}") + @ServiceInterface(name = "AdvisorManagementClientRecommendations") public interface RecommendationsService { @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations") - @ExpectedResponses({ 202 }) + @Get("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("recommendationId") String recommendationId, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("recommendationId") String recommendationId, @HeaderParam("Accept") String accept, + Context context); + + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations/{recommendationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("recommendationId") String recommendationId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RecommendationPatchPayload properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations/{recommendationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("recommendationId") String recommendationId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RecommendationPatchPayload properties, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, @QueryParam("mode") RecommendationListMode mode, + @QueryParam("$top") Integer top, @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, @QueryParam("mode") RecommendationListMode mode, + @QueryParam("$top") Integer top, @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Advisor/recommendations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenant(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Advisor/recommendations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByTenantSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}/providers/Microsoft.Advisor/recommendations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServiceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("serviceGroupName") String serviceGroupName, + @QueryParam("$filter") String filter, @QueryParam("mode") RecommendationListMode mode, + @QueryParam("$top") Integer top, @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}/providers/Microsoft.Advisor/recommendations") + @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono generate(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + Response listByServiceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("serviceGroupName") String serviceGroupName, + @QueryParam("$filter") String filter, @QueryParam("mode") RecommendationListMode mode, + @QueryParam("$top") Integer top, @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}/providers/Microsoft.Advisor/recommendations/{recommendationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByServiceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("serviceGroupName") String serviceGroupName, + @PathParam("recommendationId") String recommendationId, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}/providers/Microsoft.Advisor/recommendations/{recommendationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByServiceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("serviceGroupName") String serviceGroupName, + @PathParam("recommendationId") String recommendationId, @HeaderParam("Accept") String accept, + Context context); + + @Patch("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}/providers/Microsoft.Advisor/recommendations/{recommendationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateByServiceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("serviceGroupName") String serviceGroupName, + @PathParam("recommendationId") String recommendationId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RecommendationPatchPayload properties, + Context context); + + @Patch("/providers/Microsoft.Management/serviceGroups/{serviceGroupName}/providers/Microsoft.Advisor/recommendations/{recommendationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateByServiceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("serviceGroupName") String serviceGroupName, + @PathParam("recommendationId") String recommendationId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RecommendationPatchPayload properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono generate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + RecommendationsGenerateResponse generateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono getGenerateStatus(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("operationId") String operationId, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}") @ExpectedResponses({ 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getGenerateStatus(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @PathParam("operationId") UUID operationId, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + RecommendationsGetGenerateStatusResponse getGenerateStatusSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("operationId") String operationId, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations") + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTenantNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByTenantNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServiceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, - @QueryParam("$filter") String filter, @QueryParam("$top") Integer top, - @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); + Response listByServiceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param recommendationId The recommendation ID. + * @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 advisor Recommendation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, + String recommendationId) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + recommendationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param recommendationId The recommendation ID. + * @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 advisor Recommendation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String recommendationId) { + return getWithResponseAsync(resourceUri, recommendationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param recommendationId The recommendation ID. + * @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 advisor Recommendation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String recommendationId, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, recommendationId, + accept, context); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param recommendationId The recommendation ID. + * @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 advisor Recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceRecommendationBaseInner get(String resourceUri, String recommendationId) { + return getWithResponse(resourceUri, recommendationId, Context.NONE).getValue(); + } + + /** + * Update the state of a Recommendation. + * + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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 advisor Recommendation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String recommendationId, + RecommendationPatchPayload properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), recommendationId, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the state of a Recommendation. + * + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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 advisor Recommendation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String recommendationId, + RecommendationPatchPayload properties) { + return updateWithResponseAsync(recommendationId, properties).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update the state of a Recommendation. + * + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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 advisor Recommendation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String recommendationId, + RecommendationPatchPayload properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), recommendationId, contentType, accept, properties, context); + } + + /** + * Update the state of a Recommendation. + * + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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 advisor Recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceRecommendationBaseInner update(String recommendationId, RecommendationPatchPayload properties) { + return updateWithResponse(recommendationId, properties, Context.NONE).getValue(); + } + + /** + * Obtains recommendations for a subscription. + * + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'Critical'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, + RecommendationListMode mode, Integer top, String skipToken) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), filter, mode, top, skipToken, 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())); + } + + /** + * Obtains recommendations for a subscription. + * + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'Critical'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, RecommendationListMode mode, + Integer top, String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(filter, mode, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Obtains recommendations for a subscription. + * + * @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 ResourceRecommendationBase list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + final RecommendationListMode mode = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter, mode, top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Obtains recommendations for a subscription. + * + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'Critical'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String filter, RecommendationListMode mode, + Integer top, String skipToken) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + filter, mode, top, skipToken, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Obtains recommendations for a subscription. + * + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'Critical'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String filter, RecommendationListMode mode, + Integer top, String skipToken, Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + filter, mode, top, skipToken, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Obtains recommendations for a subscription. + * + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + final RecommendationListMode mode = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>(() -> listSinglePage(filter, mode, top, skipToken), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Obtains recommendations for a subscription. + * + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'Critical'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, RecommendationListMode mode, Integer top, + String skipToken, Context context) { + return new PagedIterable<>(() -> listSinglePage(filter, mode, top, skipToken, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking + * generateRecommendations. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', + * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTenantSinglePageAsync(String resourceUri, + String filter, Integer top, String skipToken) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByTenant(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, filter, top, skipToken, 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())); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking + * generateRecommendations. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', + * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantAsync(String resourceUri, String filter, Integer top, + String skipToken) { + return new PagedFlux<>(() -> listByTenantSinglePageAsync(resourceUri, filter, top, skipToken), + nextLink -> listByTenantNextSinglePageAsync(nextLink)); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking + * generateRecommendations. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ResourceRecommendationBase list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTenantAsync(String resourceUri) { + final String filter = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>(() -> listByTenantSinglePageAsync(resourceUri, filter, top, skipToken), + nextLink -> listByTenantNextSinglePageAsync(nextLink)); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking + * generateRecommendations. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', + * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTenantSinglePage(String resourceUri, String filter, + Integer top, String skipToken) { + final String accept = "application/json"; + Response res = service.listByTenantSync(this.client.getEndpoint(), + this.client.getApiVersion(), resourceUri, filter, top, skipToken, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking + * generateRecommendations. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', + * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByTenantSinglePage(String resourceUri, String filter, + Integer top, String skipToken, Context context) { + final String accept = "application/json"; + Response res = service.listByTenantSync(this.client.getEndpoint(), + this.client.getApiVersion(), resourceUri, filter, top, skipToken, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking + * generateRecommendations. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTenant(String resourceUri) { + final String filter = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>(() -> listByTenantSinglePage(resourceUri, filter, top, skipToken), + nextLink -> listByTenantNextSinglePage(nextLink)); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking + * generateRecommendations. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', + * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTenant(String resourceUri, String filter, Integer top, + String skipToken, Context context) { + return new PagedIterable<>(() -> listByTenantSinglePage(resourceUri, filter, top, skipToken, context), + nextLink -> listByTenantNextSinglePage(nextLink, context)); + } + + /** + * Obtains recommendations for a service group. + * + * @param serviceGroupName The name of the service group. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'High'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page. + * @param skipToken The page-continuation token for the next page. + * @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 ResourceRecommendationBase list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServiceGroupSinglePageAsync( + String serviceGroupName, String filter, RecommendationListMode mode, Integer top, String skipToken) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServiceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + serviceGroupName, filter, mode, top, skipToken, 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())); + } + + /** + * Obtains recommendations for a service group. + * + * @param serviceGroupName The name of the service group. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'High'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page. + * @param skipToken The page-continuation token for the next page. + * @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 ResourceRecommendationBase list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServiceGroupAsync(String serviceGroupName, String filter, + RecommendationListMode mode, Integer top, String skipToken) { + return new PagedFlux<>(() -> listByServiceGroupSinglePageAsync(serviceGroupName, filter, mode, top, skipToken), + nextLink -> listByServiceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Obtains recommendations for a service group. + * + * @param serviceGroupName The name of the service group. + * @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 ResourceRecommendationBase list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServiceGroupAsync(String serviceGroupName) { + final String filter = null; + final RecommendationListMode mode = null; + final Integer top = null; + final String skipToken = null; + return new PagedFlux<>(() -> listByServiceGroupSinglePageAsync(serviceGroupName, filter, mode, top, skipToken), + nextLink -> listByServiceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Obtains recommendations for a service group. + * + * @param serviceGroupName The name of the service group. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'High'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page. + * @param skipToken The page-continuation token for the next page. + * @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 ResourceRecommendationBase list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByServiceGroupSinglePage(String serviceGroupName, + String filter, RecommendationListMode mode, Integer top, String skipToken) { + final String accept = "application/json"; + Response res = service.listByServiceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), serviceGroupName, filter, mode, top, skipToken, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Obtains recommendations for a service group. + * + * @param serviceGroupName The name of the service group. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'High'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page. + * @param skipToken The page-continuation token for the next page. + * @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 ResourceRecommendationBase list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByServiceGroupSinglePage(String serviceGroupName, + String filter, RecommendationListMode mode, Integer top, String skipToken, Context context) { + final String accept = "application/json"; + Response res = service.listByServiceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), serviceGroupName, filter, mode, top, skipToken, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Obtains recommendations for a service group. + * + * @param serviceGroupName The name of the service group. + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServiceGroup(String serviceGroupName) { + final String filter = null; + final RecommendationListMode mode = null; + final Integer top = null; + final String skipToken = null; + return new PagedIterable<>(() -> listByServiceGroupSinglePage(serviceGroupName, filter, mode, top, skipToken), + nextLink -> listByServiceGroupNextSinglePage(nextLink)); + } + + /** + * Obtains recommendations for a service group. + * + * @param serviceGroupName The name of the service group. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'High'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page. + * @param skipToken The page-continuation token for the next page. + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServiceGroup(String serviceGroupName, String filter, + RecommendationListMode mode, Integer top, String skipToken, Context context) { + return new PagedIterable<>( + () -> listByServiceGroupSinglePage(serviceGroupName, filter, mode, top, skipToken, context), + nextLink -> listByServiceGroupNextSinglePage(nextLink, context)); + } + + /** + * Obtains details of a recommendation for a service group. + * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @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 advisor Recommendation along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByServiceGroupWithResponseAsync(String serviceGroupName, + String recommendationId) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByServiceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + serviceGroupName, recommendationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Obtains details of a recommendation for a service group. + * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @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 advisor Recommendation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByServiceGroupAsync(String serviceGroupName, + String recommendationId) { + return getByServiceGroupWithResponseAsync(serviceGroupName, recommendationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } - @Headers({ "Content-Type: application/json" }) - @Get("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("resourceUri") String resourceUri, @PathParam("recommendationId") String recommendationId, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + /** + * Obtains details of a recommendation for a service group. + * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @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 advisor Recommendation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByServiceGroupWithResponse(String serviceGroupName, + String recommendationId, Context context) { + final String accept = "application/json"; + return service.getByServiceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), serviceGroupName, + recommendationId, accept, context); + } - @Headers({ "Content-Type: application/json" }) - @Get("{nextLink}") - @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, Context context); + /** + * Obtains details of a recommendation for a service group. + * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @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 advisor Recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceRecommendationBaseInner getByServiceGroup(String serviceGroupName, String recommendationId) { + return getByServiceGroupWithResponse(serviceGroupName, recommendationId, Context.NONE).getValue(); } /** - * Initiates the recommendation generation or computation process for a subscription. This operation is - * asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * Updates the state of a recommendation for a service group. * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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. + * @return advisor Recommendation along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono generateWithResponseAsync() { - 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.")); - } + private Mono> updateByServiceGroupWithResponseAsync( + String serviceGroupName, String recommendationId, RecommendationPatchPayload properties) { + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.generate(this.client.getEndpoint(), this.client.getSubscriptionId(), - this.client.getApiVersion(), accept, context)) + .withContext(context -> service.updateByServiceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + serviceGroupName, recommendationId, contentType, accept, properties, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Initiates the recommendation generation or computation process for a subscription. This operation is - * asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * Updates the state of a recommendation for a service group. + * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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 advisor Recommendation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateByServiceGroupAsync(String serviceGroupName, + String recommendationId, RecommendationPatchPayload properties) { + return updateByServiceGroupWithResponseAsync(serviceGroupName, recommendationId, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates the state of a recommendation for a service group. * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. * @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 {@link Mono} that completes when a successful response is received. + * @return advisor Recommendation along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono generateWithResponseAsync(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.")); - } + public Response updateByServiceGroupWithResponse(String serviceGroupName, + String recommendationId, RecommendationPatchPayload properties, Context context) { + final String contentType = "application/json"; final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.generate(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), - accept, context); + return service.updateByServiceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + serviceGroupName, recommendationId, contentType, accept, properties, context); + } + + /** + * Updates the state of a recommendation for a service group. + * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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 advisor Recommendation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceRecommendationBaseInner updateByServiceGroup(String serviceGroupName, String recommendationId, + RecommendationPatchPayload properties) { + return updateByServiceGroupWithResponse(serviceGroupName, recommendationId, properties, Context.NONE) + .getValue(); + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is + * asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @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 generateWithResponseAsync() { + return FluxUtil + .withContext(context -> service.generate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -183,7 +1222,8 @@ private Mono generateAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) public RecommendationsGenerateResponse generateWithResponse(Context context) { - return generateWithResponseAsync(context).block(); + return service.generateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), context); } /** @@ -207,59 +1247,16 @@ public void generate() { * @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}. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getGenerateStatusWithResponseAsync(UUID operationId) { - 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 (operationId == null) { - return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); - } - final String accept = "application/json"; + private Mono getGenerateStatusWithResponseAsync(String operationId) { return FluxUtil - .withContext(context -> service.getGenerateStatus(this.client.getEndpoint(), - this.client.getSubscriptionId(), operationId, this.client.getApiVersion(), accept, context)) + .withContext(context -> service.getGenerateStatus(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), operationId, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the - * generation recommendation. The URI of this API is returned in the Location field of the response header. - * - * @param operationId The operation ID, which can be found from the Location field in the generate recommendation - * response header. - * @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> getGenerateStatusWithResponseAsync(UUID operationId, 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 (operationId == null) { - return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getGenerateStatus(this.client.getEndpoint(), this.client.getSubscriptionId(), operationId, - this.client.getApiVersion(), accept, context); - } - /** * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the * generation recommendation. The URI of this API is returned in the Location field of the response header. @@ -272,7 +1269,7 @@ private Mono> getGenerateStatusWithResponseAsync(UUID operationId * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getGenerateStatusAsync(UUID operationId) { + private Mono getGenerateStatusAsync(String operationId) { return getGenerateStatusWithResponseAsync(operationId).flatMap(ignored -> Mono.empty()); } @@ -286,11 +1283,12 @@ private Mono getGenerateStatusAsync(UUID operationId) { * @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}. + * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getGenerateStatusWithResponse(UUID operationId, Context context) { - return getGenerateStatusWithResponseAsync(operationId, context).block(); + public RecommendationsGetGenerateStatusResponse getGenerateStatusWithResponse(String operationId, Context context) { + return service.getGenerateStatusSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), operationId, context); } /** @@ -304,289 +1302,144 @@ public Response getGenerateStatusWithResponse(UUID operationId, Context co * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void getGenerateStatus(UUID operationId) { + public void getGenerateStatus(String operationId) { getGenerateStatusWithResponse(operationId, Context.NONE); } /** - * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking - * generateRecommendations. + * Get the next page of items. * - * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties - * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', - * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. - * @param top The number of recommendations per page if a paged version of this API is being used. - * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 list of Advisor recommendations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the response of a ResourceRecommendationBase list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String filter, Integer top, - String skipToken) { - 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.")); - } + private Mono> listNextSinglePageAsync(String nextLink) { final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), - this.client.getApiVersion(), filter, top, skipToken, accept, context)) + 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())); } /** - * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking - * generateRecommendations. + * Get the next page of items. * - * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties - * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', - * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. - * @param top The number of recommendations per page if a paged version of this API is being used. - * @param skipToken The page-continuation token to use with a paged version of this API. - * @param context The context to associate with this operation. + * @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 list of Advisor recommendations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the response of a ResourceRecommendationBase list operation along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String filter, Integer top, - String skipToken, 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.")); - } + private PagedResponse listNextSinglePage(String nextLink) { final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), filter, top, - skipToken, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - - /** - * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking - * generateRecommendations. - * - * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties - * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', - * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. - * @param top The number of recommendations per page if a paged version of this API is being used. - * @param skipToken The page-continuation token to use with a paged version of this API. - * @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 list of Advisor recommendations as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String filter, Integer top, String skipToken) { - return new PagedFlux<>(() -> listSinglePageAsync(filter, top, skipToken), - nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking - * generateRecommendations. - * - * @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 list of Advisor recommendations as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - final String filter = null; - final Integer top = null; - final String skipToken = null; - return new PagedFlux<>(() -> listSinglePageAsync(filter, top, skipToken), - nextLink -> listNextSinglePageAsync(nextLink)); - } - - /** - * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking - * generateRecommendations. - * - * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties - * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', - * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. - * @param top The number of recommendations per page if a paged version of this API is being used. - * @param skipToken The page-continuation token to use with a paged version of this API. - * @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 list of Advisor recommendations as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String filter, Integer top, String skipToken, - Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(filter, top, skipToken, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); - } - - /** - * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking - * generateRecommendations. - * - * @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 list of Advisor recommendations as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list() { - final String filter = null; - final Integer top = null; - final String skipToken = null; - return new PagedIterable<>(listAsync(filter, top, skipToken)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking - * generateRecommendations. + * Get the next page of items. * - * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties - * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', - * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. - * @param top The number of recommendations per page if a paged version of this API is being used. - * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 list of Advisor recommendations as paginated response with {@link PagedIterable}. + * @return the response of a ResourceRecommendationBase list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable list(String filter, Integer top, String skipToken, - Context context) { - return new PagedIterable<>(listAsync(filter, top, skipToken, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Obtains details of a cached recommendation. + * Get the next page of items. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. - * @param recommendationId The recommendation ID. + * @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 advisor Recommendation along with {@link Response} on successful completion of {@link Mono}. + * @return the response of a ResourceRecommendationBase list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceUri, - String recommendationId) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceUri == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); - } - if (recommendationId == null) { - return Mono - .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); - } + private Mono> listByTenantNextSinglePageAsync(String nextLink) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), resourceUri, recommendationId, - this.client.getApiVersion(), accept, context)) + .withContext(context -> service.listByTenantNext(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())); } /** - * Obtains details of a cached recommendation. + * Get the next page of items. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. - * @param recommendationId The recommendation ID. - * @param context The context to associate with this operation. + * @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 advisor Recommendation along with {@link Response} on successful completion of {@link Mono}. + * @return the response of a ResourceRecommendationBase list operation along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceUri, - String recommendationId, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceUri == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); - } - if (recommendationId == null) { - return Mono - .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); - } + private PagedResponse listByTenantNextSinglePage(String nextLink) { final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), resourceUri, recommendationId, this.client.getApiVersion(), - accept, context); - } - - /** - * Obtains details of a cached recommendation. - * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. - * @param recommendationId The recommendation ID. - * @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 advisor Recommendation on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceUri, String recommendationId) { - return getWithResponseAsync(resourceUri, recommendationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + Response res + = service.listByTenantNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Obtains details of a cached recommendation. + * Get the next page of items. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. - * @param recommendationId The recommendation ID. + * @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 advisor Recommendation along with {@link Response}. + * @return the response of a ResourceRecommendationBase list operation along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceUri, String recommendationId, + private PagedResponse listByTenantNextSinglePage(String nextLink, Context context) { - return getWithResponseAsync(resourceUri, recommendationId, context).block(); + final String accept = "application/json"; + Response res + = service.listByTenantNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** - * Obtains details of a cached recommendation. + * Get the next page of items. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. - * @param recommendationId The recommendation ID. + * @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 advisor Recommendation. + * @return the response of a ResourceRecommendationBase list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ResourceRecommendationBaseInner get(String resourceUri, String recommendationId) { - return getWithResponse(resourceUri, recommendationId, Context.NONE).getValue(); + private Mono> + listByServiceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByServiceGroupNext(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())); } /** @@ -596,23 +1449,15 @@ public ResourceRecommendationBaseInner get(String resourceUri, String recommenda * @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 list of Advisor recommendations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the response of a ResourceRecommendationBase list operation along with {@link PagedResponse}. */ @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.")); - } + private PagedResponse listByServiceGroupNextSinglePage(String nextLink) { 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())); + Response res + = service.listByServiceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -623,23 +1468,15 @@ private Mono> listNextSinglePageA * @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 list of Advisor recommendations along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the response of a ResourceRecommendationBase list operation along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, + private PagedResponse listByServiceGroupNextSinglePage(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)); + Response res + = service.listByServiceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsImpl.java index 11d4c4fc1b0d8..b296e0c0b31e3 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; @@ -11,10 +11,12 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.advisor.fluent.RecommendationsClient; import com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner; +import com.azure.resourcemanager.advisor.models.RecommendationListMode; +import com.azure.resourcemanager.advisor.models.RecommendationPatchPayload; import com.azure.resourcemanager.advisor.models.Recommendations; import com.azure.resourcemanager.advisor.models.RecommendationsGenerateResponse; +import com.azure.resourcemanager.advisor.models.RecommendationsGetGenerateStatusResponse; import com.azure.resourcemanager.advisor.models.ResourceRecommendationBase; -import java.util.UUID; public final class RecommendationsImpl implements Recommendations { private static final ClientLogger LOGGER = new ClientLogger(RecommendationsImpl.class); @@ -29,20 +31,38 @@ public RecommendationsImpl(RecommendationsClient innerClient, this.serviceManager = serviceManager; } - public RecommendationsGenerateResponse generateWithResponse(Context context) { - return this.serviceClient().generateWithResponse(context); + public Response getWithResponse(String resourceUri, String recommendationId, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceUri, recommendationId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ResourceRecommendationBaseImpl(inner.getValue(), this.manager())); } - public void generate() { - this.serviceClient().generate(); + public ResourceRecommendationBase get(String resourceUri, String recommendationId) { + ResourceRecommendationBaseInner inner = this.serviceClient().get(resourceUri, recommendationId); + if (inner != null) { + return new ResourceRecommendationBaseImpl(inner, this.manager()); + } else { + return null; + } } - public Response getGenerateStatusWithResponse(UUID operationId, Context context) { - return this.serviceClient().getGenerateStatusWithResponse(operationId, context); + public Response updateWithResponse(String recommendationId, + RecommendationPatchPayload properties, Context context) { + Response inner + = this.serviceClient().updateWithResponse(recommendationId, properties, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ResourceRecommendationBaseImpl(inner.getValue(), this.manager())); } - public void getGenerateStatus(UUID operationId) { - this.serviceClient().getGenerateStatus(operationId); + public ResourceRecommendationBase update(String recommendationId, RecommendationPatchPayload properties) { + ResourceRecommendationBaseInner inner = this.serviceClient().update(recommendationId, properties); + if (inner != null) { + return new ResourceRecommendationBaseImpl(inner, this.manager()); + } else { + return null; + } } public PagedIterable list() { @@ -51,28 +71,73 @@ public PagedIterable list() { inner1 -> new ResourceRecommendationBaseImpl(inner1, this.manager())); } - public PagedIterable list(String filter, Integer top, String skipToken, - Context context) { + public PagedIterable list(String filter, RecommendationListMode mode, Integer top, + String skipToken, Context context) { PagedIterable inner - = this.serviceClient().list(filter, top, skipToken, context); + = this.serviceClient().list(filter, mode, top, skipToken, context); return ResourceManagerUtils.mapPage(inner, inner1 -> new ResourceRecommendationBaseImpl(inner1, this.manager())); } - public Response getWithResponse(String resourceUri, String recommendationId, - Context context) { + public PagedIterable listByTenant(String resourceUri) { + PagedIterable inner = this.serviceClient().listByTenant(resourceUri); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ResourceRecommendationBaseImpl(inner1, this.manager())); + } + + public PagedIterable listByTenant(String resourceUri, String filter, Integer top, + String skipToken, Context context) { + PagedIterable inner + = this.serviceClient().listByTenant(resourceUri, filter, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ResourceRecommendationBaseImpl(inner1, this.manager())); + } + + public PagedIterable listByServiceGroup(String serviceGroupName) { + PagedIterable inner + = this.serviceClient().listByServiceGroup(serviceGroupName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ResourceRecommendationBaseImpl(inner1, this.manager())); + } + + public PagedIterable listByServiceGroup(String serviceGroupName, String filter, + RecommendationListMode mode, Integer top, String skipToken, Context context) { + PagedIterable inner + = this.serviceClient().listByServiceGroup(serviceGroupName, filter, mode, top, skipToken, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ResourceRecommendationBaseImpl(inner1, this.manager())); + } + + public Response getByServiceGroupWithResponse(String serviceGroupName, + String recommendationId, Context context) { Response inner - = this.serviceClient().getWithResponse(resourceUri, recommendationId, context); + = this.serviceClient().getByServiceGroupWithResponse(serviceGroupName, recommendationId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ResourceRecommendationBaseImpl(inner.getValue(), this.manager())); + } + + public ResourceRecommendationBase getByServiceGroup(String serviceGroupName, String recommendationId) { + ResourceRecommendationBaseInner inner + = this.serviceClient().getByServiceGroup(serviceGroupName, recommendationId); if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new ResourceRecommendationBaseImpl(inner.getValue(), this.manager())); + return new ResourceRecommendationBaseImpl(inner, this.manager()); } else { return null; } } - public ResourceRecommendationBase get(String resourceUri, String recommendationId) { - ResourceRecommendationBaseInner inner = this.serviceClient().get(resourceUri, recommendationId); + public Response updateByServiceGroupWithResponse(String serviceGroupName, + String recommendationId, RecommendationPatchPayload properties, Context context) { + Response inner = this.serviceClient() + .updateByServiceGroupWithResponse(serviceGroupName, recommendationId, properties, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ResourceRecommendationBaseImpl(inner.getValue(), this.manager())); + } + + public ResourceRecommendationBase updateByServiceGroup(String serviceGroupName, String recommendationId, + RecommendationPatchPayload properties) { + ResourceRecommendationBaseInner inner + = this.serviceClient().updateByServiceGroup(serviceGroupName, recommendationId, properties); if (inner != null) { return new ResourceRecommendationBaseImpl(inner, this.manager()); } else { @@ -80,6 +145,22 @@ public ResourceRecommendationBase get(String resourceUri, String recommendationI } } + public RecommendationsGenerateResponse generateWithResponse(Context context) { + return this.serviceClient().generateWithResponse(context); + } + + public void generate() { + this.serviceClient().generate(); + } + + public RecommendationsGetGenerateStatusResponse getGenerateStatusWithResponse(String operationId, Context context) { + return this.serviceClient().getGenerateStatusWithResponse(operationId, context); + } + + public void getGenerateStatus(String operationId) { + this.serviceClient().getGenerateStatus(operationId); + } + private RecommendationsClient serviceClient() { return this.innerClient; } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewImpl.java new file mode 100644 index 0000000000000..c92b1b2d1d2eb --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewInner; +import com.azure.resourcemanager.advisor.models.ResiliencyReview; +import com.azure.resourcemanager.advisor.models.ReviewStatus; + +public final class ResiliencyReviewImpl implements ResiliencyReview { + private ResiliencyReviewInner innerObject; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + ResiliencyReviewImpl(ResiliencyReviewInner innerObject, + com.azure.resourcemanager.advisor.AdvisorManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String reviewName() { + return this.innerModel().reviewName(); + } + + public String workloadName() { + return this.innerModel().workloadName(); + } + + public ReviewStatus reviewStatus() { + return this.innerModel().reviewStatus(); + } + + public Integer recommendationsCount() { + return this.innerModel().recommendationsCount(); + } + + public String publishedAt() { + return this.innerModel().publishedAt(); + } + + public String updatedAt() { + return this.innerModel().updatedAt(); + } + + public ResiliencyReviewInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsClientImpl.java new file mode 100644 index 0000000000000..ad8da8d8ff8b5 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsClientImpl.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.fluent.ResiliencyReviewsClient; +import com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewInner; +import com.azure.resourcemanager.advisor.implementation.models.ResiliencyReviewCollection; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ResiliencyReviewsClient. + */ +public final class ResiliencyReviewsClientImpl implements ResiliencyReviewsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ResiliencyReviewsService service; + + /** + * The service client containing this operation class. + */ + private final AdvisorManagementClientImpl client; + + /** + * Initializes an instance of ResiliencyReviewsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResiliencyReviewsClientImpl(AdvisorManagementClientImpl client) { + this.service + = RestProxy.create(ResiliencyReviewsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdvisorManagementClientResiliencyReviews to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdvisorManagementClientResiliencyReviews") + public interface ResiliencyReviewsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/resiliencyReviews/{reviewId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("reviewId") String reviewId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/resiliencyReviews/{reviewId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("reviewId") String reviewId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/resiliencyReviews") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, @QueryParam("$skip") Integer skip, @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/resiliencyReviews") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, @QueryParam("$skip") Integer skip, @QueryParam("$filter") String filter, + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id. + * + * @param reviewId Existing review id. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @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 existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String reviewId) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), reviewId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id. + * + * @param reviewId Existing review id. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @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 existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String reviewId) { + return getWithResponseAsync(reviewId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id. + * + * @param reviewId Existing review id. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @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 existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String reviewId, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + reviewId, accept, context); + } + + /** + * Get existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id. + * + * @param reviewId Existing review id. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @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 existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResiliencyReviewInner get(String reviewId) { + return getWithResponse(reviewId, Context.NONE).getValue(); + } + + /** + * Get list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews. + * + * @param top The number of items to be included in the result. + * @param skip The number of items to skip before starting to collect the result set. + * @param filter The filter to apply.<br>Filter can be applied to properties ['reviewStatus', 'reviewId'] with + * operators ['eq', 'and', 'or'].<br>Example:<br>- $filter=reviewStatus eq 'New'. + * @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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Integer top, Integer skip, String filter) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), top, skip, filter, 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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews. + * + * @param top The number of items to be included in the result. + * @param skip The number of items to skip before starting to collect the result set. + * @param filter The filter to apply.<br>Filter can be applied to properties ['reviewStatus', 'reviewId'] with + * operators ['eq', 'and', 'or'].<br>Example:<br>- $filter=reviewStatus eq 'New'. + * @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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, Integer skip, String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(top, skip, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews. + * + * @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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Integer top = null; + final Integer skip = null; + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(top, skip, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews. + * + * @param top The number of items to be included in the result. + * @param skip The number of items to skip before starting to collect the result set. + * @param filter The filter to apply.<br>Filter can be applied to properties ['reviewStatus', 'reviewId'] with + * operators ['eq', 'and', 'or'].<br>Example:<br>- $filter=reviewStatus eq 'New'. + * @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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Integer top, Integer skip, String filter) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), top, skip, filter, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews. + * + * @param top The number of items to be included in the result. + * @param skip The number of items to skip before starting to collect the result set. + * @param filter The filter to apply.<br>Filter can be applied to properties ['reviewStatus', 'reviewId'] with + * operators ['eq', 'and', 'or'].<br>Example:<br>- $filter=reviewStatus eq 'New'. + * @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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Integer top, Integer skip, String filter, + Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), top, skip, filter, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews. + * + * @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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Integer top = null; + final Integer skip = null; + final String filter = null; + return new PagedIterable<>(() -> listSinglePage(top, skip, filter), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Get list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews. + * + * @param top The number of items to be included in the result. + * @param skip The number of items to skip before starting to collect the result set. + * @param filter The filter to apply.<br>Filter can be applied to properties ['reviewStatus', 'reviewId'] with + * operators ['eq', 'and', 'or'].<br>Example:<br>- $filter=reviewStatus eq 'New'. + * @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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Integer top, Integer skip, String filter, Context context) { + return new PagedIterable<>(() -> listSinglePage(top, skip, filter, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get list of resiliency reviews. + * + * 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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + 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 list of resiliency reviews. + * + * 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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get list of resiliency reviews. + * + * 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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsImpl.java new file mode 100644 index 0000000000000..f54d7a4daa125 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsImpl.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.advisor.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.advisor.fluent.ResiliencyReviewsClient; +import com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewInner; +import com.azure.resourcemanager.advisor.models.ResiliencyReview; +import com.azure.resourcemanager.advisor.models.ResiliencyReviews; + +public final class ResiliencyReviewsImpl implements ResiliencyReviews { + private static final ClientLogger LOGGER = new ClientLogger(ResiliencyReviewsImpl.class); + + private final ResiliencyReviewsClient innerClient; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + public ResiliencyReviewsImpl(ResiliencyReviewsClient innerClient, + com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String reviewId, Context context) { + Response inner = this.serviceClient().getWithResponse(reviewId, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ResiliencyReviewImpl(inner.getValue(), this.manager())); + } + + public ResiliencyReview get(String reviewId) { + ResiliencyReviewInner inner = this.serviceClient().get(reviewId); + if (inner != null) { + return new ResiliencyReviewImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ResiliencyReviewImpl(inner1, this.manager())); + } + + public PagedIterable list(Integer top, Integer skip, String filter, Context context) { + PagedIterable inner = this.serviceClient().list(top, skip, filter, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ResiliencyReviewImpl(inner1, this.manager())); + } + + private ResiliencyReviewsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceManagerUtils.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceManagerUtils.java index b191ad151124e..3c033149c24c1 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceManagerUtils.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceManagerUtils.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..47b337c9cdbd9 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +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.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.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.advisor.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.advisor.fluent.models.PredictionResponseInner; +import com.azure.resourcemanager.advisor.models.PredictionRequest; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ResourceProvidersClient. + */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + /** + * The proxy service used to perform REST calls. + */ + private final ResourceProvidersService service; + + /** + * The service client containing this operation class. + */ + private final AdvisorManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(AdvisorManagementClientImpl client) { + this.service + = RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdvisorManagementClientResourceProviders to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdvisorManagementClientResourceProviders") + public interface ResourceProvidersService { + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/predict") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> predict(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PredictionRequest predictionRequest, Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/predict") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response predictSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") PredictionRequest predictionRequest, Context context); + } + + /** + * Predicts a recommendation. + * + * @param predictionRequest The request body. + * @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 response used by predictions along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> predictWithResponseAsync(PredictionRequest predictionRequest) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.predict(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, predictionRequest, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Predicts a recommendation. + * + * @param predictionRequest The request body. + * @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 response used by predictions on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono predictAsync(PredictionRequest predictionRequest) { + return predictWithResponseAsync(predictionRequest).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Predicts a recommendation. + * + * @param predictionRequest The request body. + * @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 response used by predictions along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response predictWithResponse(PredictionRequest predictionRequest, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.predictSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, predictionRequest, context); + } + + /** + * Predicts a recommendation. + * + * @param predictionRequest The request body. + * @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 response used by predictions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PredictionResponseInner predict(PredictionRequest predictionRequest) { + return predictWithResponse(predictionRequest, Context.NONE).getValue(); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..d2b89b28d939f --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersImpl.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.advisor.implementation; + +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.advisor.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.advisor.fluent.models.PredictionResponseInner; +import com.azure.resourcemanager.advisor.models.PredictionRequest; +import com.azure.resourcemanager.advisor.models.PredictionResponse; +import com.azure.resourcemanager.advisor.models.ResourceProviders; + +public final class ResourceProvidersImpl implements ResourceProviders { + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + public ResourceProvidersImpl(ResourceProvidersClient innerClient, + com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response predictWithResponse(PredictionRequest predictionRequest, Context context) { + Response inner = this.serviceClient().predictWithResponse(predictionRequest, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PredictionResponseImpl(inner.getValue(), this.manager())); + } + + public PredictionResponse predict(PredictionRequest predictionRequest) { + PredictionResponseInner inner = this.serviceClient().predict(predictionRequest); + if (inner != null) { + return new PredictionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceRecommendationBaseImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceRecommendationBaseImpl.java index ccdc39c54e6dd..851e3b5190d2b 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceRecommendationBaseImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceRecommendationBaseImpl.java @@ -1,20 +1,29 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; +import com.azure.core.management.SystemData; +import com.azure.core.util.BinaryData; import com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner; import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationPropertiesResourceWorkload; +import com.azure.resourcemanager.advisor.models.RecommendationPropertiesReview; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; import com.azure.resourcemanager.advisor.models.ResourceMetadata; import com.azure.resourcemanager.advisor.models.ResourceRecommendationBase; +import com.azure.resourcemanager.advisor.models.ResourceRecommendationSavings; +import com.azure.resourcemanager.advisor.models.Risk; import com.azure.resourcemanager.advisor.models.ShortDescription; +import com.azure.resourcemanager.advisor.models.TrackedRecommendationProperties; import java.time.OffsetDateTime; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.UUID; public final class ResourceRecommendationBaseImpl implements ResourceRecommendationBase { private ResourceRecommendationBaseInner innerObject; @@ -39,10 +48,18 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public Category category() { return this.innerModel().category(); } + public Control control() { + return this.innerModel().control(); + } + public Impact impact() { return this.innerModel().impact(); } @@ -55,12 +72,56 @@ public String impactedValue() { return this.innerModel().impactedValue(); } + public String criticalityScore() { + return this.innerModel().criticalityScore(); + } + + public String criticality() { + return this.innerModel().criticality(); + } + + public String scoreChangedAt() { + return this.innerModel().scoreChangedAt(); + } + + public String serviceGroupId() { + return this.innerModel().serviceGroupId(); + } + + public ResourceRecommendationSavings savings() { + return this.innerModel().savings(); + } + + public RecommendationStatus recommendationStatus() { + return this.innerModel().recommendationStatus(); + } + + public String completionType() { + return this.innerModel().completionType(); + } + + public RecommendationDismissReason recommendationDismissReason() { + return this.innerModel().recommendationDismissReason(); + } + + public OffsetDateTime postponedUntilDateTime() { + return this.innerModel().postponedUntilDateTime(); + } + + public OffsetDateTime lastRefreshed() { + return this.innerModel().lastRefreshed(); + } + public OffsetDateTime lastUpdated() { return this.innerModel().lastUpdated(); } - public Map metadata() { - Map inner = this.innerModel().metadata(); + public OffsetDateTime createdTime() { + return this.innerModel().createdTime(); + } + + public Map metadata() { + Map inner = this.innerModel().metadata(); if (inner != null) { return Collections.unmodifiableMap(inner); } else { @@ -72,17 +133,16 @@ public String recommendationTypeId() { return this.innerModel().recommendationTypeId(); } + public Risk risk() { + return this.innerModel().risk(); + } + public ShortDescription shortDescription() { return this.innerModel().shortDescription(); } - public List suppressionIds() { - List inner = this.innerModel().suppressionIds(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } + public String suppressionId() { + return this.innerModel().suppressionId(); } public Map extendedProperties() { @@ -114,8 +174,8 @@ public String potentialBenefits() { return this.innerModel().potentialBenefits(); } - public List> actions() { - List> inner = this.innerModel().actions(); + public List> actions() { + List> inner = this.innerModel().actions(); if (inner != null) { return Collections.unmodifiableList(inner); } else { @@ -123,8 +183,8 @@ public List> actions() { } } - public Map remediation() { - Map inner = this.innerModel().remediation(); + public Map remediation() { + Map inner = this.innerModel().remediation(); if (inner != null) { return Collections.unmodifiableMap(inner); } else { @@ -132,8 +192,8 @@ public Map remediation() { } } - public Map exposedMetadataProperties() { - Map inner = this.innerModel().exposedMetadataProperties(); + public Map exposedMetadataProperties() { + Map inner = this.innerModel().exposedMetadataProperties(); if (inner != null) { return Collections.unmodifiableMap(inner); } else { @@ -141,6 +201,26 @@ public Map exposedMetadataProperties() { } } + public TrackedRecommendationProperties trackedProperties() { + return this.innerModel().trackedProperties(); + } + + public RecommendationPropertiesReview review() { + return this.innerModel().review(); + } + + public RecommendationPropertiesResourceWorkload resourceWorkload() { + return this.innerModel().resourceWorkload(); + } + + public String sourceSystem() { + return this.innerModel().sourceSystem(); + } + + public String notes() { + return this.innerModel().notes(); + } + public ResourceRecommendationBaseInner innerModel() { return this.innerObject; } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java index ecf81cf3c9aaf..18f06cae203e4 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.advisor.fluent.models.SuppressionContractInner; import com.azure.resourcemanager.advisor.models.SuppressionContract; @@ -32,6 +33,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public String suppressionId() { return this.innerModel().suppressionId(); } @@ -40,8 +45,8 @@ public String ttl() { return this.innerModel().ttl(); } - public OffsetDateTime expirationTimestamp() { - return this.innerModel().expirationTimestamp(); + public OffsetDateTime expirationTimeStamp() { + return this.innerModel().expirationTimeStamp(); } public SuppressionContractInner innerModel() { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java index c0c5ad180f117..6b33abaf85feb 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; @@ -30,7 +30,7 @@ import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.advisor.fluent.SuppressionsClient; import com.azure.resourcemanager.advisor.fluent.models.SuppressionContractInner; -import com.azure.resourcemanager.advisor.models.SuppressionContractListResult; +import com.azure.resourcemanager.advisor.implementation.models.SuppressionContractListResult; import reactor.core.publisher.Mono; /** @@ -62,44 +62,85 @@ public final class SuppressionsClientImpl implements SuppressionsClient { * The interface defining all the services for AdvisorManagementClientSuppressions to be used by the proxy service * to perform REST calls. */ - @Host("{$host}") - @ServiceInterface(name = "AdvisorManagementCli") + @Host("{endpoint}") + @ServiceInterface(name = "AdvisorManagementClientSuppressions") public interface SuppressionsService { @Headers({ "Content-Type: application/json" }) @Get("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ManagementException.class, code = { 404 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> get(@HostParam("$host") String endpoint, - @PathParam("resourceUri") String resourceUri, @PathParam("recommendationId") String recommendationId, - @PathParam("name") String name, @QueryParam("api-version") String apiVersion, + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("recommendationId") String recommendationId, @PathParam("name") String name, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") + @Get("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(value = ManagementException.class, code = { 404 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> create(@HostParam("$host") String endpoint, - @PathParam("resourceUri") String resourceUri, @PathParam("recommendationId") String recommendationId, - @PathParam("name") String name, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") SuppressionContractInner suppressionContract, + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("recommendationId") String recommendationId, @PathParam("name") String name, @HeaderParam("Accept") String accept, Context context); - @Headers({ "Content-Type: application/json" }) + @Put("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ManagementException.class, code = { 404 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("recommendationId") String recommendationId, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SuppressionContractInner suppressionContract, Context context); + + @Put("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(value = ManagementException.class, code = { 404 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("recommendationId") String recommendationId, @PathParam("name") String name, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") SuppressionContractInner suppressionContract, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) @Delete("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") @ExpectedResponses({ 204 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete(@HostParam("$host") String endpoint, @PathParam("resourceUri") String resourceUri, - @PathParam("recommendationId") String recommendationId, @PathParam("name") String name, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("recommendationId") String recommendationId, @PathParam("name") String name, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("recommendationId") String recommendationId, @PathParam("name") String name, Context context); @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> list(@HostParam("$host") String endpoint, - @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @QueryParam("$top") Integer top, @QueryParam("$skipToken") String skipToken, @HeaderParam("Accept") String accept, Context context); @@ -108,15 +149,22 @@ Mono> list(@HostParam("$host") String en @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** * Obtains the details of a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -129,70 +177,17 @@ Mono> listNext( @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceUri, String recommendationId, String name) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceUri == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); - } - if (recommendationId == null) { - return Mono - .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); - } - if (name == null) { - return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); - } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.get(this.client.getEndpoint(), resourceUri, recommendationId, name, - this.client.getApiVersion(), accept, context)) + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + recommendationId, name, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** * Obtains the details of a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. - * @param recommendationId The recommendation ID. - * @param name The name of the suppression. - * @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 ManagementException thrown if the request is rejected by server on status code 404. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with - * the rule along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceUri, String recommendationId, - String name, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceUri == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); - } - if (recommendationId == null) { - return Mono - .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); - } - if (name == null) { - return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), resourceUri, recommendationId, name, this.client.getApiVersion(), - accept, context); - } - - /** - * Obtains the details of a suppression. - * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -211,8 +206,7 @@ private Mono getAsync(String resourceUri, String recom /** * Obtains the details of a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @param context The context to associate with this operation. @@ -226,14 +220,15 @@ private Mono getAsync(String resourceUri, String recom @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceUri, String recommendationId, String name, Context context) { - return getWithResponseAsync(resourceUri, recommendationId, name, context).block(); + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, recommendationId, + name, accept, context); } /** * Obtains the details of a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -252,8 +247,7 @@ public SuppressionContractInner get(String resourceUri, String recommendationId, * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to * as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. @@ -267,30 +261,11 @@ public SuppressionContractInner get(String resourceUri, String recommendationId, @ServiceMethod(returns = ReturnType.SINGLE) private Mono> createWithResponseAsync(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceUri == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); - } - if (recommendationId == null) { - return Mono - .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); - } - if (name == null) { - return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); - } - if (suppressionContract == null) { - return Mono - .error(new IllegalArgumentException("Parameter suppressionContract is required and cannot be null.")); - } else { - suppressionContract.validate(); - } + final String contentType = "application/json"; final String accept = "application/json"; return FluxUtil - .withContext(context -> service.create(this.client.getEndpoint(), resourceUri, recommendationId, name, - this.client.getApiVersion(), suppressionContract, accept, context)) + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + recommendationId, name, contentType, accept, suppressionContract, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -298,54 +273,7 @@ private Mono> createWithResponseAsync(String * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to * as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. - * @param recommendationId The recommendation ID. - * @param name The name of the suppression. - * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. - * @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 ManagementException thrown if the request is rejected by server on status code 404. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with - * the rule along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createWithResponseAsync(String resourceUri, - String recommendationId, String name, SuppressionContractInner suppressionContract, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceUri == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); - } - if (recommendationId == null) { - return Mono - .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); - } - if (name == null) { - return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); - } - if (suppressionContract == null) { - return Mono - .error(new IllegalArgumentException("Parameter suppressionContract is required and cannot be null.")); - } else { - suppressionContract.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.create(this.client.getEndpoint(), resourceUri, recommendationId, name, - this.client.getApiVersion(), suppressionContract, accept, context); - } - - /** - * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to - * as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. - * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. @@ -367,8 +295,7 @@ private Mono createAsync(String resourceUri, String re * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to * as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. @@ -383,15 +310,17 @@ private Mono createAsync(String resourceUri, String re @ServiceMethod(returns = ReturnType.SINGLE) public Response createWithResponse(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract, Context context) { - return createWithResponseAsync(resourceUri, recommendationId, name, suppressionContract, context).block(); + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, recommendationId, + name, contentType, accept, suppressionContract, context); } /** * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to * as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. @@ -412,8 +341,7 @@ public SuppressionContractInner create(String resourceUri, String recommendation * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a * recommendation is referred to as a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -423,24 +351,9 @@ public SuppressionContractInner create(String resourceUri, String recommendation */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> deleteWithResponseAsync(String resourceUri, String recommendationId, String name) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceUri == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); - } - if (recommendationId == null) { - return Mono - .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); - } - if (name == null) { - return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); - } - final String accept = "application/json"; return FluxUtil - .withContext(context -> service.delete(this.client.getEndpoint(), resourceUri, recommendationId, name, - this.client.getApiVersion(), accept, context)) + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + recommendationId, name, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -448,45 +361,7 @@ private Mono> deleteWithResponseAsync(String resourceUri, String * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a * recommendation is referred to as a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. - * @param recommendationId The recommendation ID. - * @param name The name of the suppression. - * @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 resourceUri, String recommendationId, String name, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (resourceUri == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); - } - if (recommendationId == null) { - return Mono - .error(new IllegalArgumentException("Parameter recommendationId is required and cannot be null.")); - } - if (name == null) { - return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), resourceUri, recommendationId, name, - this.client.getApiVersion(), accept, context); - } - - /** - * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a - * recommendation is referred to as a suppression. - * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -503,8 +378,7 @@ private Mono deleteAsync(String resourceUri, String recommendationId, Stri * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a * recommendation is referred to as a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @param context The context to associate with this operation. @@ -516,15 +390,15 @@ private Mono deleteAsync(String resourceUri, String recommendationId, Stri @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String resourceUri, String recommendationId, String name, Context context) { - return deleteWithResponseAsync(resourceUri, recommendationId, name, context).block(); + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, recommendationId, + name, context); } /** * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a * recommendation is referred to as a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -545,23 +419,15 @@ public void delete(String resourceUri, String recommendationId, String 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 list of Advisor suppressions along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the response of a SuppressionContract list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(Integer top, String skipToken) { - 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.")); - } final String accept = "application/json"; return FluxUtil - .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), - this.client.getApiVersion(), top, skipToken, accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), top, skipToken, 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())); @@ -573,46 +439,29 @@ private Mono> listSinglePageAsync(Intege * * @param top The number of suppressions per page if a paged version of this API is being used. * @param skipToken The page-continuation token to use with a paged version of this API. - * @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 list of Advisor suppressions along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the response of a SuppressionContract list operation as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Integer top, String skipToken, - 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.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), top, - skipToken, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Integer top, String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(top, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); } /** * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of * a recommendation is referred to as a suppression. * - * @param top The number of suppressions per page if a paged version of this API is being used. - * @param skipToken The page-continuation token to use with a paged version of this API. - * @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 list of Advisor suppressions as paginated response with {@link PagedFlux}. + * @return the response of a SuppressionContract list operation as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Integer top, String skipToken) { + private PagedFlux listAsync() { + final Integer top = null; + final String skipToken = null; return new PagedFlux<>(() -> listSinglePageAsync(top, skipToken), nextLink -> listNextSinglePageAsync(nextLink)); } @@ -621,16 +470,20 @@ private PagedFlux listAsync(Integer top, String skipTo * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of * a recommendation is referred to as a suppression. * + * @param top The number of suppressions per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 list of Advisor suppressions as paginated response with {@link PagedFlux}. + * @return the response of a SuppressionContract list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - final Integer top = null; - final String skipToken = null; - return new PagedFlux<>(() -> listSinglePageAsync(top, skipToken), - nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Integer top, String skipToken) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), top, skipToken, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -643,12 +496,15 @@ private PagedFlux listAsync() { * @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 list of Advisor suppressions as paginated response with {@link PagedFlux}. + * @return the response of a SuppressionContract list operation along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Integer top, String skipToken, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(top, skipToken, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Integer top, String skipToken, Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), top, skipToken, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -657,13 +513,13 @@ private PagedFlux listAsync(Integer top, String skipTo * * @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 list of Advisor suppressions as paginated response with {@link PagedIterable}. + * @return the response of a SuppressionContract list operation as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { final Integer top = null; final String skipToken = null; - return new PagedIterable<>(listAsync(top, skipToken)); + return new PagedIterable<>(() -> listSinglePage(top, skipToken), nextLink -> listNextSinglePage(nextLink)); } /** @@ -676,11 +532,12 @@ public PagedIterable list() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of Advisor suppressions as paginated response with {@link PagedIterable}. + * @return the response of a SuppressionContract list operation as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Integer top, String skipToken, Context context) { - return new PagedIterable<>(listAsync(top, skipToken, context)); + return new PagedIterable<>(() -> listSinglePage(top, skipToken, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -690,18 +547,11 @@ public PagedIterable list(Integer top, String skipToke * @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 list of Advisor suppressions along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the response of a SuppressionContract list operation 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(), @@ -709,6 +559,24 @@ private Mono> listNextSinglePageAsync(St .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. + * @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 SuppressionContract list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -717,22 +585,14 @@ private Mono> listNextSinglePageAsync(St * @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 list of Advisor suppressions along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the response of a SuppressionContract list operation along with {@link PagedResponse}. */ @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.")); - } + private PagedResponse listNextSinglePage(String nextLink, Context context) { 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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsImpl.java index 331bb004d8115..7f0836c82c635 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.implementation; @@ -31,12 +31,8 @@ public Response getWithResponse(String resourceUri, String Context context) { Response inner = this.serviceClient().getWithResponse(resourceUri, recommendationId, name, context); - if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new SuppressionContractImpl(inner.getValue(), this.manager())); - } else { - return null; - } + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SuppressionContractImpl(inner.getValue(), this.manager())); } public SuppressionContract get(String resourceUri, String recommendationId, String name) { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadResultImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadResultImpl.java new file mode 100644 index 0000000000000..c1f1487b48127 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadResultImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.implementation; + +import com.azure.resourcemanager.advisor.fluent.models.WorkloadResultInner; +import com.azure.resourcemanager.advisor.models.WorkloadResult; + +public final class WorkloadResultImpl implements WorkloadResult { + private WorkloadResultInner innerObject; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + WorkloadResultImpl(WorkloadResultInner innerObject, + com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String subscriptionId() { + return this.innerModel().subscriptionId(); + } + + public String subscriptionName() { + return this.innerModel().subscriptionName(); + } + + public WorkloadResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsClientImpl.java new file mode 100644 index 0000000000000..e960289168f5b --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsClientImpl.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.fluent.WorkloadsClient; +import com.azure.resourcemanager.advisor.fluent.models.WorkloadResultInner; +import com.azure.resourcemanager.advisor.implementation.models.WorkloadListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in WorkloadsClient. + */ +public final class WorkloadsClientImpl implements WorkloadsClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkloadsService service; + + /** + * The service client containing this operation class. + */ + private final AdvisorManagementClientImpl client; + + /** + * Initializes an instance of WorkloadsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkloadsClientImpl(AdvisorManagementClientImpl client) { + this.service + = RestProxy.create(WorkloadsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AdvisorManagementClientWorkloads to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AdvisorManagementClientWorkloads") + public interface WorkloadsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/workloads") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/workloads") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get Workloads list. + * + * Get list of Workloads. + * + * @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 workloads list. + * + * Get list of Workloads along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), 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 Workloads list. + * + * Get list of Workloads. + * + * @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 workloads list. + * + * Get list of Workloads as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get Workloads list. + * + * Get list of Workloads. + * + * @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 workloads list. + * + * Get list of Workloads along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get Workloads list. + * + * Get list of Workloads. + * + * @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 workloads list. + * + * Get list of Workloads along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get Workloads list. + * + * Get list of Workloads. + * + * @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 workloads list. + * + * Get list of Workloads as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Get Workloads list. + * + * Get list of Workloads. + * + * @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 workloads list. + * + * Get list of Workloads as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get Workloads list. + * + * 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 workloads list. + * + * Get list of Workloads along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + 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 Workloads list. + * + * 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 workloads list. + * + * Get list of Workloads along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get Workloads list. + * + * 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 workloads list. + * + * Get list of Workloads along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsImpl.java new file mode 100644 index 0000000000000..6b24b4e66420f --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.fluent.WorkloadsClient; +import com.azure.resourcemanager.advisor.fluent.models.WorkloadResultInner; +import com.azure.resourcemanager.advisor.models.WorkloadResult; +import com.azure.resourcemanager.advisor.models.Workloads; + +public final class WorkloadsImpl implements Workloads { + private static final ClientLogger LOGGER = new ClientLogger(WorkloadsImpl.class); + + private final WorkloadsClient innerClient; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + public WorkloadsImpl(WorkloadsClient innerClient, com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkloadResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkloadResultImpl(inner1, this.manager())); + } + + private WorkloadsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.advisor.AdvisorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AdvisorScoreResponse.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AdvisorScoreResponse.java new file mode 100644 index 0000000000000..64ad14a1238f9 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AdvisorScoreResponse.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.implementation.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.advisor.fluent.models.AdvisorScoreEntityInner; +import java.io.IOException; +import java.util.List; + +/** + * The AdvisorScoreResponse model. + */ +@Immutable +public final class AdvisorScoreResponse implements JsonSerializable { + /* + * The list of operations. + */ + private List value; + + /** + * Creates an instance of AdvisorScoreResponse class. + */ + private AdvisorScoreResponse() { + } + + /** + * Get the value property: The list of operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AdvisorScoreResponse from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdvisorScoreResponse 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 AdvisorScoreResponse. + */ + public static AdvisorScoreResponse fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdvisorScoreResponse deserializedAdvisorScoreResponse = new AdvisorScoreResponse(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AdvisorScoreEntityInner.fromJson(reader1)); + deserializedAdvisorScoreResponse.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedAdvisorScoreResponse; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentListResult.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentListResult.java new file mode 100644 index 0000000000000..b1c452adedc37 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.implementation.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.advisor.fluent.models.AssessmentResultInner; +import java.io.IOException; +import java.util.List; + +/** + * Paged collection of AssessmentResult items. + */ +@Immutable +public final class AssessmentListResult implements JsonSerializable { + /* + * The AssessmentResult items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of AssessmentListResult class. + */ + private AssessmentListResult() { + } + + /** + * Get the value property: The AssessmentResult 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; + } + + /** + * {@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 AssessmentListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssessmentListResult 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 AssessmentListResult. + */ + public static AssessmentListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssessmentListResult deserializedAssessmentListResult = new AssessmentListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AssessmentResultInner.fromJson(reader1)); + deserializedAssessmentListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAssessmentListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssessmentListResult; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentTypeListResult.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentTypeListResult.java new file mode 100644 index 0000000000000..c1c4ec46b04e7 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentTypeListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.implementation.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.advisor.fluent.models.AssessmentTypeResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The Advisor assessment type list result data structure. + */ +@Immutable +public final class AssessmentTypeListResult implements JsonSerializable { + /* + * The AssessmentTypeResult items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of AssessmentTypeListResult class. + */ + private AssessmentTypeListResult() { + } + + /** + * Get the value property: The AssessmentTypeResult 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; + } + + /** + * {@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 AssessmentTypeListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AssessmentTypeListResult 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 AssessmentTypeListResult. + */ + public static AssessmentTypeListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AssessmentTypeListResult deserializedAssessmentTypeListResult = new AssessmentTypeListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AssessmentTypeResultInner.fromJson(reader1)); + deserializedAssessmentTypeListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAssessmentTypeListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAssessmentTypeListResult; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigurationListResult.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/ConfigurationListResult.java similarity index 65% rename from sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigurationListResult.java rename to sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/ConfigurationListResult.java index abcd2de8d78f4..98c3eb6c9aa90 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigurationListResult.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/ConfigurationListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.advisor.models; +package com.azure.resourcemanager.advisor.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,28 +14,28 @@ import java.util.List; /** - * The list of Advisor configurations. + * Paged collection of ConfigData items. */ -@Fluent +@Immutable public final class ConfigurationListResult implements JsonSerializable { /* - * The list of configurations. + * The ConfigData items on this page */ private List value; /* - * The link used to get the next page of configurations. + * The link to the next page of items */ private String nextLink; /** * Creates an instance of ConfigurationListResult class. */ - public ConfigurationListResult() { + private ConfigurationListResult() { } /** - * Get the value property: The list of configurations. + * Get the value property: The ConfigData items on this page. * * @return the value value. */ @@ -44,18 +44,7 @@ public List value() { } /** - * Set the value property: The list of configurations. - * - * @param value the value value to set. - * @return the ConfigurationListResult object itself. - */ - public ConfigurationListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The link used to get the next page of configurations. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -63,28 +52,6 @@ public String nextLink() { return this.nextLink; } - /** - * Set the nextLink property: The link used to get the next page of configurations. - * - * @param nextLink the nextLink value to set. - * @return the ConfigurationListResult object itself. - */ - public ConfigurationListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } - /** * {@inheritDoc} */ @@ -102,6 +69,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of ConfigurationListResult 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 ConfigurationListResult. */ public static ConfigurationListResult fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/MetadataEntityListResult.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/MetadataEntityListResult.java similarity index 66% rename from sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/MetadataEntityListResult.java rename to sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/MetadataEntityListResult.java index f74e828afe619..02dc7a32d10d1 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/MetadataEntityListResult.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/MetadataEntityListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.advisor.models; +package com.azure.resourcemanager.advisor.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,28 +14,28 @@ import java.util.List; /** - * The list of metadata entities. + * The response of a MetadataEntity list operation. */ -@Fluent +@Immutable public final class MetadataEntityListResult implements JsonSerializable { /* - * The list of metadata entities. + * The MetadataEntity items on this page */ private List value; /* - * The link used to get the next page of metadata. + * The link to the next page of items */ private String nextLink; /** * Creates an instance of MetadataEntityListResult class. */ - public MetadataEntityListResult() { + private MetadataEntityListResult() { } /** - * Get the value property: The list of metadata entities. + * Get the value property: The MetadataEntity items on this page. * * @return the value value. */ @@ -44,18 +44,7 @@ public List value() { } /** - * Set the value property: The list of metadata entities. - * - * @param value the value value to set. - * @return the MetadataEntityListResult object itself. - */ - public MetadataEntityListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The link used to get the next page of metadata. + * Get the nextLink property: The link to the next page of items. * * @return the nextLink value. */ @@ -63,28 +52,6 @@ public String nextLink() { return this.nextLink; } - /** - * Set the nextLink property: The link used to get the next page of metadata. - * - * @param nextLink the nextLink value to set. - * @return the MetadataEntityListResult object itself. - */ - public MetadataEntityListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } - /** * {@inheritDoc} */ @@ -102,6 +69,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of MetadataEntityListResult 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 MetadataEntityListResult. */ public static MetadataEntityListResult fromJson(JsonReader jsonReader) throws IOException { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/OperationEntityListResult.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/OperationEntityListResult.java similarity index 63% rename from sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/OperationEntityListResult.java rename to sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/OperationEntityListResult.java index 5992b5bcbe651..e7fa715a12264 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/OperationEntityListResult.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/OperationEntityListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.advisor.models; +package com.azure.resourcemanager.advisor.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,48 +14,28 @@ import java.util.List; /** - * The list of Advisor operations. + * Paged collection of OperationEntity items. */ -@Fluent +@Immutable public final class OperationEntityListResult implements JsonSerializable { /* - * The link used to get the next page of operations. + * The OperationEntity items on this page */ - private String nextLink; + private List value; /* - * The list of operations. + * The link to the next page of items */ - private List value; + private String nextLink; /** * Creates an instance of OperationEntityListResult class. */ - public OperationEntityListResult() { + private OperationEntityListResult() { } /** - * Get the nextLink property: The link used to get the next page of operations. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: The link used to get the next page of operations. - * - * @param nextLink the nextLink value to set. - * @return the OperationEntityListResult object itself. - */ - public OperationEntityListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Get the value property: The list of operations. + * Get the value property: The OperationEntity items on this page. * * @return the value value. */ @@ -64,25 +44,12 @@ public List value() { } /** - * Set the value property: The list of operations. - * - * @param value the value value to set. - * @return the OperationEntityListResult object itself. - */ - public OperationEntityListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Validates the instance. + * Get the nextLink property: The link to the next page of items. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @return the nextLink value. */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } + public String nextLink() { + return this.nextLink; } /** @@ -91,8 +58,8 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("nextLink", this.nextLink); jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); return jsonWriter.writeEndObject(); } @@ -102,6 +69,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of OperationEntityListResult 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 OperationEntityListResult. */ public static OperationEntityListResult fromJson(JsonReader jsonReader) throws IOException { @@ -111,12 +79,12 @@ public static OperationEntityListResult fromJson(JsonReader jsonReader) throws I String fieldName = reader.getFieldName(); reader.nextToken(); - if ("nextLink".equals(fieldName)) { - deserializedOperationEntityListResult.nextLink = reader.getString(); - } else if ("value".equals(fieldName)) { + if ("value".equals(fieldName)) { List value = reader.readArray(reader1 -> OperationEntityInner.fromJson(reader1)); deserializedOperationEntityListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationEntityListResult.nextLink = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResiliencyReviewCollection.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResiliencyReviewCollection.java new file mode 100644 index 0000000000000..9062b1be097f0 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResiliencyReviewCollection.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.implementation.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.advisor.fluent.models.ResiliencyReviewInner; +import java.io.IOException; +import java.util.List; + +/** + * Collection of Resiliency Reviews. + */ +@Immutable +public final class ResiliencyReviewCollection implements JsonSerializable { + /* + * The ResiliencyReview items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ResiliencyReviewCollection class. + */ + private ResiliencyReviewCollection() { + } + + /** + * Get the value property: The ResiliencyReview 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; + } + + /** + * {@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 ResiliencyReviewCollection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResiliencyReviewCollection 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 ResiliencyReviewCollection. + */ + public static ResiliencyReviewCollection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResiliencyReviewCollection deserializedResiliencyReviewCollection = new ResiliencyReviewCollection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ResiliencyReviewInner.fromJson(reader1)); + deserializedResiliencyReviewCollection.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedResiliencyReviewCollection.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResiliencyReviewCollection; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationBaseListResult.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResourceRecommendationBaseListResult.java similarity index 64% rename from sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationBaseListResult.java rename to sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResourceRecommendationBaseListResult.java index 35a3205c83cc2..12fad3f08eec3 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationBaseListResult.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResourceRecommendationBaseListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.advisor.models; +package com.azure.resourcemanager.advisor.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,49 +14,29 @@ import java.util.List; /** - * The list of Advisor recommendations. + * The response of a ResourceRecommendationBase list operation. */ -@Fluent +@Immutable public final class ResourceRecommendationBaseListResult implements JsonSerializable { /* - * The link used to get the next page of recommendations. + * The ResourceRecommendationBase items on this page */ - private String nextLink; + private List value; /* - * The list of recommendations. + * The link to the next page of items */ - private List value; + private String nextLink; /** * Creates an instance of ResourceRecommendationBaseListResult class. */ - public ResourceRecommendationBaseListResult() { + private ResourceRecommendationBaseListResult() { } /** - * Get the nextLink property: The link used to get the next page of recommendations. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: The link used to get the next page of recommendations. - * - * @param nextLink the nextLink value to set. - * @return the ResourceRecommendationBaseListResult object itself. - */ - public ResourceRecommendationBaseListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Get the value property: The list of recommendations. + * Get the value property: The ResourceRecommendationBase items on this page. * * @return the value value. */ @@ -65,25 +45,12 @@ public List value() { } /** - * Set the value property: The list of recommendations. - * - * @param value the value value to set. - * @return the ResourceRecommendationBaseListResult object itself. - */ - public ResourceRecommendationBaseListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Validates the instance. + * Get the nextLink property: The link to the next page of items. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @return the nextLink value. */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } + public String nextLink() { + return this.nextLink; } /** @@ -92,8 +59,8 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("nextLink", this.nextLink); jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); return jsonWriter.writeEndObject(); } @@ -103,6 +70,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of ResourceRecommendationBaseListResult 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 ResourceRecommendationBaseListResult. */ public static ResourceRecommendationBaseListResult fromJson(JsonReader jsonReader) throws IOException { @@ -113,12 +81,12 @@ public static ResourceRecommendationBaseListResult fromJson(JsonReader jsonReade String fieldName = reader.getFieldName(); reader.nextToken(); - if ("nextLink".equals(fieldName)) { - deserializedResourceRecommendationBaseListResult.nextLink = reader.getString(); - } else if ("value".equals(fieldName)) { + if ("value".equals(fieldName)) { List value = reader.readArray(reader1 -> ResourceRecommendationBaseInner.fromJson(reader1)); deserializedResourceRecommendationBaseListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedResourceRecommendationBaseListResult.nextLink = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/SuppressionContractListResult.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/SuppressionContractListResult.java similarity index 63% rename from sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/SuppressionContractListResult.java rename to sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/SuppressionContractListResult.java index 90bd98ba2e146..45aabe3435e27 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/SuppressionContractListResult.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/SuppressionContractListResult.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. -package com.azure.resourcemanager.advisor.models; +package com.azure.resourcemanager.advisor.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,48 +14,28 @@ import java.util.List; /** - * The list of Advisor suppressions. + * The response of a SuppressionContract list operation. */ -@Fluent +@Immutable public final class SuppressionContractListResult implements JsonSerializable { /* - * The link used to get the next page of suppressions. + * The SuppressionContract items on this page */ - private String nextLink; + private List value; /* - * The list of suppressions. + * The link to the next page of items */ - private List value; + private String nextLink; /** * Creates an instance of SuppressionContractListResult class. */ - public SuppressionContractListResult() { + private SuppressionContractListResult() { } /** - * Get the nextLink property: The link used to get the next page of suppressions. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: The link used to get the next page of suppressions. - * - * @param nextLink the nextLink value to set. - * @return the SuppressionContractListResult object itself. - */ - public SuppressionContractListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - - /** - * Get the value property: The list of suppressions. + * Get the value property: The SuppressionContract items on this page. * * @return the value value. */ @@ -64,25 +44,12 @@ public List value() { } /** - * Set the value property: The list of suppressions. - * - * @param value the value value to set. - * @return the SuppressionContractListResult object itself. - */ - public SuppressionContractListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Validates the instance. + * Get the nextLink property: The link to the next page of items. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @return the nextLink value. */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } + public String nextLink() { + return this.nextLink; } /** @@ -91,8 +58,8 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("nextLink", this.nextLink); jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); return jsonWriter.writeEndObject(); } @@ -102,6 +69,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { * @param jsonReader The JsonReader being read. * @return An instance of SuppressionContractListResult 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 SuppressionContractListResult. */ public static SuppressionContractListResult fromJson(JsonReader jsonReader) throws IOException { @@ -112,12 +80,12 @@ public static SuppressionContractListResult fromJson(JsonReader jsonReader) thro String fieldName = reader.getFieldName(); reader.nextToken(); - if ("nextLink".equals(fieldName)) { - deserializedSuppressionContractListResult.nextLink = reader.getString(); - } else if ("value".equals(fieldName)) { + if ("value".equals(fieldName)) { List value = reader.readArray(reader1 -> SuppressionContractInner.fromJson(reader1)); deserializedSuppressionContractListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSuppressionContractListResult.nextLink = reader.getString(); } else { reader.skipChildren(); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/WorkloadListResult.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/WorkloadListResult.java new file mode 100644 index 0000000000000..6dbb682ae09b2 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/models/WorkloadListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.implementation.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.advisor.fluent.models.WorkloadResultInner; +import java.io.IOException; +import java.util.List; + +/** + * The Workload list result data structure. + */ +@Immutable +public final class WorkloadListResult implements JsonSerializable { + /* + * List of WorkloadListResult items on this page. + */ + private List value; + + /* + * Url to get the next Page of WorkloadListResult items. + */ + private String nextLink; + + /** + * Creates an instance of WorkloadListResult class. + */ + private WorkloadListResult() { + } + + /** + * Get the value property: List of WorkloadListResult items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Url to get the next Page of WorkloadListResult items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@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 WorkloadListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadListResult 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 WorkloadListResult. + */ + public static WorkloadListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadListResult deserializedWorkloadListResult = new WorkloadListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkloadResultInner.fromJson(reader1)); + deserializedWorkloadListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkloadListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadListResult; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/package-info.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/package-info.java index cf79ade45a1e7..4122120a7d83f 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/package-info.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the implementations for AdvisorManagementClient. - * REST APIs for Azure Advisor. + * Package containing the implementations for Advisor. + * REST APIs for Azure Advisor Resiliency Reviews. */ package com.azure.resourcemanager.advisor.implementation; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreEntity.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreEntity.java new file mode 100644 index 0000000000000..f6fe555166759 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreEntity.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.advisor.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner; +import java.util.List; + +/** + * An immutable client-side representation of AdvisorScoreEntity. + */ +public interface AdvisorScoreEntity { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the lastRefreshedScore property: The details of latest available score. + * + * @return the lastRefreshedScore value. + */ + ScoreEntity lastRefreshedScore(); + + /** + * Gets the timeSeries property: The historic Advisor score data. + * + * @return the timeSeries value. + */ + List timeSeries(); + + /** + * Gets the inner com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner object. + * + * @return the inner object. + */ + AdvisorScoreEntityInner innerModel(); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScores.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScores.java new file mode 100644 index 0000000000000..cb7ab10a2e862 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScores.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.advisor.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 AdvisorScores. + */ +public interface AdvisorScores { + /** + * Gets the advisor score. + * + * @param name The scope of Advisor score entity. + * @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 advisor score along with {@link Response}. + */ + Response getWithResponse(String name, Context context); + + /** + * Gets the advisor score. + * + * @param name The scope of Advisor score entity. + * @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 advisor score. + */ + AdvisorScoreEntity get(String name); + + /** + * Gets the list of advisor scores. + * + * @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 list of advisor scores as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets the list of advisor scores. + * + * @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 list of advisor scores as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Aggregated.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Aggregated.java new file mode 100644 index 0000000000000..a02402df51177 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Aggregated.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.advisor.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The aggregation level of the score. + */ +public final class Aggregated extends ExpandableStringEnum { + /** + * Static value week for Aggregated. + */ + public static final Aggregated WEEK = fromString("week"); + + /** + * Static value day for Aggregated. + */ + public static final Aggregated DAY = fromString("day"); + + /** + * Static value month for Aggregated. + */ + public static final Aggregated MONTH = fromString("month"); + + /** + * Creates a new instance of Aggregated value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Aggregated() { + } + + /** + * Creates or finds a Aggregated from its string representation. + * + * @param name a name to look for. + * @return the corresponding Aggregated. + */ + public static Aggregated fromString(String name) { + return fromString(name, Aggregated.class); + } + + /** + * Gets known Aggregated values. + * + * @return known Aggregated values. + */ + public static Collection values() { + return values(Aggregated.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentResult.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentResult.java new file mode 100644 index 0000000000000..dcafb50eddb34 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentResult.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.advisor.fluent.models.AssessmentResultInner; + +/** + * An immutable client-side representation of AssessmentResult. + */ +public interface AssessmentResult { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the workloadId property: Workload Id. + * + * @return the workloadId value. + */ + String workloadId(); + + /** + * Gets the workloadName property: Workload Name. + * + * @return the workloadName value. + */ + String workloadName(); + + /** + * Gets the assessmentId property: Assessment Id. + * + * @return the assessmentId value. + */ + String assessmentId(); + + /** + * Gets the description property: Assessment Type Description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the typeId property: Assessment Type Id. + * + * @return the typeId value. + */ + String typeId(); + + /** + * Gets the typePropertiesType property: Assessment Type. + * + * @return the typePropertiesType value. + */ + String typePropertiesType(); + + /** + * Gets the score property: Assessment Score. + * + * @return the score value. + */ + Integer score(); + + /** + * Gets the state property: Assessment State. + * + * @return the state value. + */ + String state(); + + /** + * Gets the typeVersion property: Assessment Type Version. + * + * @return the typeVersion value. + */ + String typeVersion(); + + /** + * Gets the locale property: Assessment Type Locale. + * + * @return the locale value. + */ + String locale(); + + /** + * Gets the inner com.azure.resourcemanager.advisor.fluent.models.AssessmentResultInner object. + * + * @return the inner object. + */ + AssessmentResultInner innerModel(); + + /** + * The entirety of the AssessmentResult definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + + /** + * The AssessmentResult definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the AssessmentResult definition. + */ + interface Blank extends WithCreate { + } + + /** + * The stage of the AssessmentResult 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.WithWorkloadId, DefinitionStages.WithTypeId, DefinitionStages.WithLocale { + /** + * Executes the create request. + * + * @return the created resource. + */ + AssessmentResult create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AssessmentResult create(Context context); + } + + /** + * The stage of the AssessmentResult definition allowing to specify workloadId. + */ + interface WithWorkloadId { + /** + * Specifies the workloadId property: Workload Id.. + * + * @param workloadId Workload Id. + * @return the next definition stage. + */ + WithCreate withWorkloadId(String workloadId); + } + + /** + * The stage of the AssessmentResult definition allowing to specify typeId. + */ + interface WithTypeId { + /** + * Specifies the typeId property: Assessment Type Id.. + * + * @param typeId Assessment Type Id. + * @return the next definition stage. + */ + WithCreate withTypeId(String typeId); + } + + /** + * The stage of the AssessmentResult definition allowing to specify locale. + */ + interface WithLocale { + /** + * Specifies the locale property: Assessment Type Locale.. + * + * @param locale Assessment Type Locale. + * @return the next definition stage. + */ + WithCreate withLocale(String locale); + } + } + + /** + * Begins update for the AssessmentResult resource. + * + * @return the stage of resource update. + */ + AssessmentResult.Update update(); + + /** + * The template for AssessmentResult update. + */ + interface Update extends UpdateStages.WithWorkloadId, UpdateStages.WithTypeId, UpdateStages.WithLocale { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AssessmentResult apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AssessmentResult apply(Context context); + } + + /** + * The AssessmentResult update stages. + */ + interface UpdateStages { + /** + * The stage of the AssessmentResult update allowing to specify workloadId. + */ + interface WithWorkloadId { + /** + * Specifies the workloadId property: Workload Id.. + * + * @param workloadId Workload Id. + * @return the next definition stage. + */ + Update withWorkloadId(String workloadId); + } + + /** + * The stage of the AssessmentResult update allowing to specify typeId. + */ + interface WithTypeId { + /** + * Specifies the typeId property: Assessment Type Id.. + * + * @param typeId Assessment Type Id. + * @return the next definition stage. + */ + Update withTypeId(String typeId); + } + + /** + * The stage of the AssessmentResult update allowing to specify locale. + */ + interface WithLocale { + /** + * Specifies the locale property: Assessment Type Locale.. + * + * @param locale Assessment Type Locale. + * @return the next definition stage. + */ + Update withLocale(String locale); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AssessmentResult refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AssessmentResult refresh(Context context); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypeResult.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypeResult.java new file mode 100644 index 0000000000000..6dbd60ef2d92a --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypeResult.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.resourcemanager.advisor.fluent.models.AssessmentTypeResultInner; + +/** + * An immutable client-side representation of AssessmentTypeResult. + */ +public interface AssessmentTypeResult { + /** + * Gets the id property: Assessment Type Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the title property: Assessment Type Title. + * + * @return the title value. + */ + String title(); + + /** + * Gets the description property: Assessment Type Description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the locale property: Assessment Type Locale. + * + * @return the locale value. + */ + String locale(); + + /** + * Gets the version property: Assessment Type Version. + * + * @return the version value. + */ + String version(); + + /** + * Gets the inner com.azure.resourcemanager.advisor.fluent.models.AssessmentTypeResultInner object. + * + * @return the inner object. + */ + AssessmentTypeResultInner innerModel(); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypes.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypes.java new file mode 100644 index 0000000000000..4697c5788576b --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypes.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of AssessmentTypes. + */ +public interface AssessmentTypes { + /** + * Get assessment types list. + * + * Get list of Azure Advisor assessment types. + * + * @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 assessment types list. + * + * Get list of Azure Advisor assessment types as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get assessment types list. + * + * Get list of Azure Advisor assessment types. + * + * @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 assessment types list. + * + * Get list of Azure Advisor assessment types as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Assessments.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Assessments.java new file mode 100644 index 0000000000000..73ba7103c06d9 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Assessments.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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 Assessments. + */ +public interface Assessments { + /** + * Get an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 an existing Azure Advisor assessment along with {@link Response}. + */ + Response getWithResponse(String assessmentName, Context context); + + /** + * Get an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 an existing Azure Advisor assessment. + */ + AssessmentResult get(String assessmentName); + + /** + * Delete an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 assessmentName, Context context); + + /** + * Delete an existing Azure Advisor assessment. + * + * @param assessmentName Advisor assessment 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 assessmentName); + + /** + * Get list of Azure Advisor assessments. + * + * @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 list of Azure Advisor assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get list of Azure Advisor assessments. + * + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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 list of Azure Advisor assessments as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String top, String skiptoken, Context context); + + /** + * Get an existing Azure Advisor assessment. + * + * @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 an existing Azure Advisor assessment along with {@link Response}. + */ + AssessmentResult getById(String id); + + /** + * Get an existing Azure Advisor assessment. + * + * @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 an existing Azure Advisor assessment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an existing Azure Advisor assessment. + * + * @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 an existing Azure Advisor assessment. + * + * @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 AssessmentResult resource. + * + * @param name resource name. + * @return the first stage of the new AssessmentResult definition. + */ + AssessmentResult.DefinitionStages.Blank define(String name); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Category.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Category.java index bbec11a481f64..292212d80a27e 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Category.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Category.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; @@ -8,7 +8,7 @@ import java.util.Collection; /** - * Defines values for Category. + * The category of the recommendation. */ public final class Category extends ExpandableStringEnum { /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigData.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigData.java index a6a599714f0bf..88a3e5eb6e0b3 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigData.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigData.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.advisor.fluent.models.ConfigDataInner; import java.util.List; @@ -33,6 +34,13 @@ public interface ConfigData { */ String type(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the exclude property: Exclude the resource from Advisor evaluations. Valid values: False (default) or True. * @@ -48,6 +56,14 @@ public interface ConfigData { */ CpuThreshold lowCpuThreshold(); + /** + * Gets the duration property: Minimum duration for Advisor low CPU utilization evaluation. Valid only for + * subscriptions. Valid values: 7 (default), 14, 21, 30, 60 or 90. + * + * @return the duration value. + */ + DurationModel duration(); + /** * Gets the digests property: Advisor digest configuration. Valid only for subscriptions. * @@ -96,8 +112,8 @@ interface WithResourceGroup { * The stage of the ConfigData 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.WithExclude, DefinitionStages.WithLowCpuThreshold, DefinitionStages.WithDigests { + interface WithCreate extends DefinitionStages.WithExclude, DefinitionStages.WithLowCpuThreshold, + DefinitionStages.WithDuration, DefinitionStages.WithDigests { /** * Executes the create request. * @@ -143,6 +159,21 @@ interface WithLowCpuThreshold { WithCreate withLowCpuThreshold(CpuThreshold lowCpuThreshold); } + /** + * The stage of the ConfigData definition allowing to specify duration. + */ + interface WithDuration { + /** + * Specifies the duration property: Minimum duration for Advisor low CPU utilization evaluation. Valid only + * for subscriptions. Valid values: 7 (default), 14, 21, 30, 60 or 90.. + * + * @param duration Minimum duration for Advisor low CPU utilization evaluation. Valid only for + * subscriptions. Valid values: 7 (default), 14, 21, 30, 60 or 90. + * @return the next definition stage. + */ + WithCreate withDuration(DurationModel duration); + } + /** * The stage of the ConfigData definition allowing to specify digests. */ diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigurationName.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigurationName.java index bbe25a80a0ec0..f3ba35ce76d9e 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigurationName.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigurationName.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Configurations.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Configurations.java index 582f7893c8e02..5019b7ed39f3b 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Configurations.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Configurations.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; @@ -20,7 +20,7 @@ public interface Configurations { * * @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 list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ PagedIterable list(); @@ -33,7 +33,7 @@ public interface Configurations { * @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 list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); @@ -74,7 +74,7 @@ Response createInSubscriptionWithResponse(ConfigurationName configur * @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 list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroup); @@ -86,7 +86,7 @@ Response createInSubscriptionWithResponse(ConfigurationName configur * @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 list of Advisor configurations as paginated response with {@link PagedIterable}. + * @return paged collection of ConfigData items as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroup, Context context); diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Control.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Control.java new file mode 100644 index 0000000000000..7b98a01f90d3f --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Control.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.advisor.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The sub-category of the recommendation. + */ +public final class Control extends ExpandableStringEnum { + /** + * Static value HighAvailability for Control. + */ + public static final Control HIGH_AVAILABILITY = fromString("HighAvailability"); + + /** + * Static value BusinessContinuity for Control. + */ + public static final Control BUSINESS_CONTINUITY = fromString("BusinessContinuity"); + + /** + * Static value DisasterRecovery for Control. + */ + public static final Control DISASTER_RECOVERY = fromString("DisasterRecovery"); + + /** + * Static value Scalability for Control. + */ + public static final Control SCALABILITY = fromString("Scalability"); + + /** + * Static value MonitoringAndAlerting for Control. + */ + public static final Control MONITORING_AND_ALERTING = fromString("MonitoringAndAlerting"); + + /** + * Static value ServiceUpgradeAndRetirement for Control. + */ + public static final Control SERVICE_UPGRADE_AND_RETIREMENT = fromString("ServiceUpgradeAndRetirement"); + + /** + * Static value Other for Control. + */ + public static final Control OTHER = fromString("Other"); + + /** + * Static value PrioritizedRecommendations for Control. + */ + public static final Control PRIORITIZED_RECOMMENDATIONS = fromString("PrioritizedRecommendations"); + + /** + * Static value Personalized for Control. + */ + public static final Control PERSONALIZED = fromString("Personalized"); + + /** + * Creates a new instance of Control value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Control() { + } + + /** + * Creates or finds a Control from its string representation. + * + * @param name a name to look for. + * @return the corresponding Control. + */ + public static Control fromString(String name) { + return fromString(name, Control.class); + } + + /** + * Gets known Control values. + * + * @return known Control values. + */ + public static Collection values() { + return values(Control.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/CpuThreshold.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/CpuThreshold.java index cbbee30075661..ddd5ecb47d966 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/CpuThreshold.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/CpuThreshold.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DigestConfig.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DigestConfig.java index 88f476a622791..835fb6a345481 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DigestConfig.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DigestConfig.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; @@ -182,14 +182,6 @@ public DigestConfig withState(DigestConfigState state) { return this; } - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - /** * {@inheritDoc} */ diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DigestConfigState.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DigestConfigState.java index aad09c377c1e7..edd23c00ce480 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DigestConfigState.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DigestConfigState.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DurationModel.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DurationModel.java new file mode 100644 index 0000000000000..49c58ac6a981d --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DurationModel.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Minimum duration for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 7 (default), + * 14, 21, 30, 60 or 90. + */ +public final class DurationModel extends ExpandableStringEnum { + /** + * Static value 7 for DurationModel. + */ + public static final DurationModel SEVEN = fromString("7"); + + /** + * Static value 14 for DurationModel. + */ + public static final DurationModel ONE_FOUR = fromString("14"); + + /** + * Static value 21 for DurationModel. + */ + public static final DurationModel TWO_ONE = fromString("21"); + + /** + * Static value 30 for DurationModel. + */ + public static final DurationModel THREE_ZERO = fromString("30"); + + /** + * Static value 60 for DurationModel. + */ + public static final DurationModel SIX_ZERO = fromString("60"); + + /** + * Static value 90 for DurationModel. + */ + public static final DurationModel NINE_ZERO = fromString("90"); + + /** + * Creates a new instance of DurationModel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DurationModel() { + } + + /** + * Creates or finds a DurationModel from its string representation. + * + * @param name a name to look for. + * @return the corresponding DurationModel. + */ + public static DurationModel fromString(String name) { + return fromString(name, DurationModel.class); + } + + /** + * Gets known DurationModel values. + * + * @return known DurationModel values. + */ + public static Collection values() { + return values(DurationModel.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Impact.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Impact.java index c6f07120146dd..26a80e70b5913 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Impact.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Impact.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/MetadataEntity.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/MetadataEntity.java index 86e9d52966138..178bfb9493fe9 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/MetadataEntity.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/MetadataEntity.java @@ -1,9 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.advisor.fluent.models.MetadataEntityInner; import java.util.List; @@ -12,25 +13,32 @@ */ public interface MetadataEntity { /** - * Gets the id property: The resource Id of the metadata entity. + * Gets the id property: Fully qualified resource Id for the resource. * * @return the id value. */ String id(); /** - * Gets the type property: The type of the metadata entity. + * 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 name property: The name of the metadata entity. + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. * - * @return the name value. + * @return the systemData value. */ - String name(); + SystemData systemData(); /** * Gets the displayName property: The display name. diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/MetadataSupportedValueDetail.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/MetadataSupportedValueDetail.java index c1ec2a5083adc..5b5d5eb88dfa2 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/MetadataSupportedValueDetail.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/MetadataSupportedValueDetail.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,7 +14,7 @@ /** * The metadata supported value detail. */ -@Fluent +@Immutable public final class MetadataSupportedValueDetail implements JsonSerializable { /* * The id. @@ -29,7 +29,7 @@ public final class MetadataSupportedValueDetail implements JsonSerializable { /* * The description of the operation. @@ -39,7 +39,7 @@ public final class OperationDisplayInfo implements JsonSerializable list(); /** - * Lists all the available Advisor REST API operations. + * 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 the list of Advisor operations as paginated response with {@link PagedIterable}. + * @return paged collection of OperationEntity items as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionRequest.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionRequest.java new file mode 100644 index 0000000000000..501b8e89c696f --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionRequest.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.advisor.fluent.models.PredictionRequestProperties; +import java.io.IOException; + +/** + * Parameters for predict recommendation. + */ +@Fluent +public final class PredictionRequest implements JsonSerializable { + /* + * Request properties for prediction recommendation. + */ + private PredictionRequestProperties innerProperties; + + /** + * Creates an instance of PredictionRequest class. + */ + public PredictionRequest() { + } + + /** + * Get the innerProperties property: Request properties for prediction recommendation. + * + * @return the innerProperties value. + */ + private PredictionRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the predictionType property: Type of the prediction. + * + * @return the predictionType value. + */ + public PredictionType predictionType() { + return this.innerProperties() == null ? null : this.innerProperties().predictionType(); + } + + /** + * Set the predictionType property: Type of the prediction. + * + * @param predictionType the predictionType value to set. + * @return the PredictionRequest object itself. + */ + public PredictionRequest withPredictionType(PredictionType predictionType) { + if (this.innerProperties() == null) { + this.innerProperties = new PredictionRequestProperties(); + } + this.innerProperties().withPredictionType(predictionType); + return this; + } + + /** + * Get the extendedProperties property: Extended properties are arguments specific for each prediction type. + * + * @return the extendedProperties value. + */ + public BinaryData extendedProperties() { + return this.innerProperties() == null ? null : this.innerProperties().extendedProperties(); + } + + /** + * Set the extendedProperties property: Extended properties are arguments specific for each prediction type. + * + * @param extendedProperties the extendedProperties value to set. + * @return the PredictionRequest object itself. + */ + public PredictionRequest withExtendedProperties(BinaryData extendedProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new PredictionRequestProperties(); + } + this.innerProperties().withExtendedProperties(extendedProperties); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PredictionRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PredictionRequest 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 PredictionRequest. + */ + public static PredictionRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PredictionRequest deserializedPredictionRequest = new PredictionRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedPredictionRequest.innerProperties = PredictionRequestProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPredictionRequest; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionResponse.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionResponse.java new file mode 100644 index 0000000000000..f2319edc9e006 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionResponse.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.PredictionResponseInner; +import java.time.OffsetDateTime; + +/** + * An immutable client-side representation of PredictionResponse. + */ +public interface PredictionResponse { + /** + * Gets the extendedProperties property: Extended properties. + * + * @return the extendedProperties value. + */ + BinaryData extendedProperties(); + + /** + * Gets the predictionType property: Type of the prediction. + * + * @return the predictionType value. + */ + PredictionType predictionType(); + + /** + * Gets the category property: The category of the recommendation. + * + * @return the category value. + */ + Category category(); + + /** + * Gets the impact property: The business impact of the recommendation. + * + * @return the impact value. + */ + Impact impact(); + + /** + * Gets the impactedField property: The resource type identified by Advisor. + * + * @return the impactedField value. + */ + String impactedField(); + + /** + * Gets the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation. + * + * @return the lastUpdated value. + */ + OffsetDateTime lastUpdated(); + + /** + * Gets the shortDescription property: A summary of the recommendation. + * + * @return the shortDescription value. + */ + ShortDescription shortDescription(); + + /** + * Gets the inner com.azure.resourcemanager.advisor.fluent.models.PredictionResponseInner object. + * + * @return the inner object. + */ + PredictionResponseInner innerModel(); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionType.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionType.java new file mode 100644 index 0000000000000..35e7054d3ed4e --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionType.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.advisor.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of the prediction. + */ +public final class PredictionType extends ExpandableStringEnum { + /** + * Static value PredictiveRightsizing for PredictionType. + */ + public static final PredictionType PREDICTIVE_RIGHTSIZING = fromString("PredictiveRightsizing"); + + /** + * Creates a new instance of PredictionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PredictionType() { + } + + /** + * Creates or finds a PredictionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PredictionType. + */ + public static PredictionType fromString(String name) { + return fromString(name, PredictionType.class); + } + + /** + * Gets known PredictionType values. + * + * @return known PredictionType values. + */ + public static Collection values() { + return values(PredictionType.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Priority.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Priority.java new file mode 100644 index 0000000000000..1a9b4233c0aef --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Priority.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.advisor.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The Priority of the Recommendation. + */ +public final class Priority extends ExpandableStringEnum { + /** + * Static value Critical for Priority. + */ + public static final Priority CRITICAL = fromString("Critical"); + + /** + * Static value High for Priority. + */ + public static final Priority HIGH = fromString("High"); + + /** + * Static value Medium for Priority. + */ + public static final Priority MEDIUM = fromString("Medium"); + + /** + * Static value Low for Priority. + */ + public static final Priority LOW = fromString("Low"); + + /** + * Static value Informational for Priority. + */ + public static final Priority INFORMATIONAL = fromString("Informational"); + + /** + * Creates a new instance of Priority value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Priority() { + } + + /** + * Creates or finds a Priority from its string representation. + * + * @param name a name to look for. + * @return the corresponding Priority. + */ + public static Priority fromString(String name) { + return fromString(name, Priority.class); + } + + /** + * Gets known Priority values. + * + * @return known Priority values. + */ + public static Collection values() { + return values(Priority.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationDismissReason.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationDismissReason.java new file mode 100644 index 0000000000000..ba732599bb696 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationDismissReason.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The reason for dismissing the Recommendation. + */ +public final class RecommendationDismissReason extends ExpandableStringEnum { + /** + * Static value ExcessiveCostInvestmentRequired for RecommendationDismissReason. + */ + public static final RecommendationDismissReason EXCESSIVE_COST_INVESTMENT_REQUIRED + = fromString("ExcessiveCostInvestmentRequired"); + + /** + * Static value TooComplexOrImpracticalToImplement for RecommendationDismissReason. + */ + public static final RecommendationDismissReason TOO_COMPLEX_OR_IMPRACTICAL_TO_IMPLEMENT + = fromString("TooComplexOrImpracticalToImplement"); + + /** + * Static value AnAlternativeSolutionIsAlreadyInPlace for RecommendationDismissReason. + */ + public static final RecommendationDismissReason AN_ALTERNATIVE_SOLUTION_IS_ALREADY_IN_PLACE + = fromString("AnAlternativeSolutionIsAlreadyInPlace"); + + /** + * Static value IncompatibleWithTheCurrentConfiguration for RecommendationDismissReason. + */ + public static final RecommendationDismissReason INCOMPATIBLE_WITH_THE_CURRENT_CONFIGURATION + = fromString("IncompatibleWithTheCurrentConfiguration"); + + /** + * Static value ImplementationStepsAreUnclear for RecommendationDismissReason. + */ + public static final RecommendationDismissReason IMPLEMENTATION_STEPS_ARE_UNCLEAR + = fromString("ImplementationStepsAreUnclear"); + + /** + * Static value RiskIsAcceptable for RecommendationDismissReason. + */ + public static final RecommendationDismissReason RISK_IS_ACCEPTABLE = fromString("RiskIsAcceptable"); + + /** + * Static value Other for RecommendationDismissReason. + */ + public static final RecommendationDismissReason OTHER = fromString("Other"); + + /** + * Creates a new instance of RecommendationDismissReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RecommendationDismissReason() { + } + + /** + * Creates or finds a RecommendationDismissReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendationDismissReason. + */ + public static RecommendationDismissReason fromString(String name) { + return fromString(name, RecommendationDismissReason.class); + } + + /** + * Gets known RecommendationDismissReason values. + * + * @return known RecommendationDismissReason values. + */ + public static Collection values() { + return values(RecommendationDismissReason.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationListMode.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationListMode.java new file mode 100644 index 0000000000000..a97632afa8526 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationListMode.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The mode used to retrieve recommendations. + */ +public final class RecommendationListMode extends ExpandableStringEnum { + /** + * Returns all recommendations. + */ + public static final RecommendationListMode ALL = fromString("all"); + + /** + * Returns prioritized subset of recommendations ordered descending by their criticality score. + */ + public static final RecommendationListMode CONTEXTUAL = fromString("contextual"); + + /** + * Creates a new instance of RecommendationListMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RecommendationListMode() { + } + + /** + * Creates or finds a RecommendationListMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendationListMode. + */ + public static RecommendationListMode fromString(String name) { + return fromString(name, RecommendationListMode.class); + } + + /** + * Gets known RecommendationListMode values. + * + * @return known RecommendationListMode values. + */ + public static Collection values() { + return values(RecommendationListMode.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationMetadatas.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationMetadatas.java index b8a047665b9f2..151a97c2183f4 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationMetadatas.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationMetadatas.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; @@ -51,11 +51,25 @@ public interface RecommendationMetadatas { /** * Gets the list of metadata entities. * + * @param filter The filter to apply to the recommendation metadata.<br>Filter can be applied to properties + * ['[recommendationCategory](#category)', '[recommendationSubCategory](#recommendationSubCategory)', + * 'RetirementDate'] with operators ['eq', 'and', 'le', 'ge']<br>The filter can also be applied to property + * ['[TrackingIds]']<br><br>âš  **Note:** `recommendationControl` is a legacy filter property and will be + * deprecated in the future. Please use `recommendationSubCategory` for filtering recommendation + * subcategory.<br><br>Valid options for recommendationSubCategory: ['BusinessContinuity', + * 'DisasterRecovery', 'HighAvailability', 'MonitoringAndAlerting', 'Other', 'Personalized', + * 'PrioritizedRecommendations', 'Scalability', 'ServiceUpgradeAndRetirement', + * 'Validation']<br><br>Example:<br>- $filter=recommendationCategory eq 'HighAvailability' and + * recommendationSubCategory eq 'ServiceUpgradeAndRetirement' and retirementDate ge '2024-01-01' and retirementDate + * le '2028-01-01'. Filter can be applied on trackingIds as well.<br>- $filter=trackingIds/any(t: t eq + * 'some-guid')<br><br>âš  **Note:** `trackingIDs` filter can be used for filtering one value at a time. + * The support to filter multiple values is not currently available. Also the support to add other filters along + * with `trackingIDs` is not available. * @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 list of metadata entities as paginated response with {@link PagedIterable}. */ - PagedIterable list(Context context); + PagedIterable list(String filter, Context context); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPatchPayload.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPatchPayload.java new file mode 100644 index 0000000000000..65d9766dae5ee --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPatchPayload.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.advisor.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; + +/** + * The recommendation patch payload. + */ +@Fluent +public final class RecommendationPatchPayload implements JsonSerializable { + /* + * The properties for recommendation patch payload. + */ + private RecommendationStatePropertiesPayload properties; + + /** + * Creates an instance of RecommendationPatchPayload class. + */ + public RecommendationPatchPayload() { + } + + /** + * Get the properties property: The properties for recommendation patch payload. + * + * @return the properties value. + */ + public RecommendationStatePropertiesPayload properties() { + return this.properties; + } + + /** + * Set the properties property: The properties for recommendation patch payload. + * + * @param properties the properties value to set. + * @return the RecommendationPatchPayload object itself. + */ + public RecommendationPatchPayload withProperties(RecommendationStatePropertiesPayload properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecommendationPatchPayload from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecommendationPatchPayload 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 RecommendationPatchPayload. + */ + public static RecommendationPatchPayload fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecommendationPatchPayload deserializedRecommendationPatchPayload = new RecommendationPatchPayload(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRecommendationPatchPayload.properties + = RecommendationStatePropertiesPayload.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRecommendationPatchPayload; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesResourceWorkload.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesResourceWorkload.java new file mode 100644 index 0000000000000..09d731f1f9c37 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesResourceWorkload.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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 Workload that this Resource belongs to. + */ +@Immutable +public final class RecommendationPropertiesResourceWorkload + implements JsonSerializable { + /* + * The Id of the Workload + */ + private String id; + + /* + * The Name of the Workload + */ + private String name; + + /** + * Creates an instance of RecommendationPropertiesResourceWorkload class. + */ + private RecommendationPropertiesResourceWorkload() { + } + + /** + * Get the id property: The Id of the Workload. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The Name of the Workload. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecommendationPropertiesResourceWorkload from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecommendationPropertiesResourceWorkload 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 RecommendationPropertiesResourceWorkload. + */ + public static RecommendationPropertiesResourceWorkload fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecommendationPropertiesResourceWorkload deserializedRecommendationPropertiesResourceWorkload + = new RecommendationPropertiesResourceWorkload(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRecommendationPropertiesResourceWorkload.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRecommendationPropertiesResourceWorkload.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRecommendationPropertiesResourceWorkload; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesReview.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesReview.java new file mode 100644 index 0000000000000..b78067248fdcd --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesReview.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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 Review that this Recommendation belongs to. + */ +@Immutable +public final class RecommendationPropertiesReview implements JsonSerializable { + /* + * The ARM Resource Id of the Review + */ + private String id; + + /* + * The Name of the Review + */ + private String name; + + /** + * Creates an instance of RecommendationPropertiesReview class. + */ + private RecommendationPropertiesReview() { + } + + /** + * Get the id property: The ARM Resource Id of the Review. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The Name of the Review. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecommendationPropertiesReview from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecommendationPropertiesReview 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 RecommendationPropertiesReview. + */ + public static RecommendationPropertiesReview fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecommendationPropertiesReview deserializedRecommendationPropertiesReview + = new RecommendationPropertiesReview(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRecommendationPropertiesReview.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRecommendationPropertiesReview.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRecommendationPropertiesReview; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatePropertiesPayload.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatePropertiesPayload.java new file mode 100644 index 0000000000000..2fec465617209 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatePropertiesPayload.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Properties for recommendation state patch payload. + */ +@Fluent +public final class RecommendationStatePropertiesPayload + implements JsonSerializable { + /* + * The state of the recommendation. + */ + private RecommendationStatus recommendationStatus; + + /* + * The reason the state of the Recommendation was changed. + */ + private RecommendationDismissReason recommendationDismissReason; + + /* + * The time the Recommendation was postponed until. + */ + private OffsetDateTime postponedUntilDateTime; + + /** + * Creates an instance of RecommendationStatePropertiesPayload class. + */ + public RecommendationStatePropertiesPayload() { + } + + /** + * Get the recommendationStatus property: The state of the recommendation. + * + * @return the recommendationStatus value. + */ + public RecommendationStatus recommendationStatus() { + return this.recommendationStatus; + } + + /** + * Set the recommendationStatus property: The state of the recommendation. + * + * @param recommendationStatus the recommendationStatus value to set. + * @return the RecommendationStatePropertiesPayload object itself. + */ + public RecommendationStatePropertiesPayload withRecommendationStatus(RecommendationStatus recommendationStatus) { + this.recommendationStatus = recommendationStatus; + return this; + } + + /** + * Get the recommendationDismissReason property: The reason the state of the Recommendation was changed. + * + * @return the recommendationDismissReason value. + */ + public RecommendationDismissReason recommendationDismissReason() { + return this.recommendationDismissReason; + } + + /** + * Set the recommendationDismissReason property: The reason the state of the Recommendation was changed. + * + * @param recommendationDismissReason the recommendationDismissReason value to set. + * @return the RecommendationStatePropertiesPayload object itself. + */ + public RecommendationStatePropertiesPayload + withRecommendationDismissReason(RecommendationDismissReason recommendationDismissReason) { + this.recommendationDismissReason = recommendationDismissReason; + return this; + } + + /** + * Get the postponedUntilDateTime property: The time the Recommendation was postponed until. + * + * @return the postponedUntilDateTime value. + */ + public OffsetDateTime postponedUntilDateTime() { + return this.postponedUntilDateTime; + } + + /** + * Set the postponedUntilDateTime property: The time the Recommendation was postponed until. + * + * @param postponedUntilDateTime the postponedUntilDateTime value to set. + * @return the RecommendationStatePropertiesPayload object itself. + */ + public RecommendationStatePropertiesPayload withPostponedUntilDateTime(OffsetDateTime postponedUntilDateTime) { + this.postponedUntilDateTime = postponedUntilDateTime; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("recommendationStatus", + this.recommendationStatus == null ? null : this.recommendationStatus.toString()); + jsonWriter.writeStringField("recommendationDismissReason", + this.recommendationDismissReason == null ? null : this.recommendationDismissReason.toString()); + jsonWriter.writeStringField("postponedUntilDateTime", + this.postponedUntilDateTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.postponedUntilDateTime)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecommendationStatePropertiesPayload from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecommendationStatePropertiesPayload 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 RecommendationStatePropertiesPayload. + */ + public static RecommendationStatePropertiesPayload fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecommendationStatePropertiesPayload deserializedRecommendationStatePropertiesPayload + = new RecommendationStatePropertiesPayload(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("recommendationStatus".equals(fieldName)) { + deserializedRecommendationStatePropertiesPayload.recommendationStatus + = RecommendationStatus.fromString(reader.getString()); + } else if ("recommendationDismissReason".equals(fieldName)) { + deserializedRecommendationStatePropertiesPayload.recommendationDismissReason + = RecommendationDismissReason.fromString(reader.getString()); + } else if ("postponedUntilDateTime".equals(fieldName)) { + deserializedRecommendationStatePropertiesPayload.postponedUntilDateTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedRecommendationStatePropertiesPayload; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatus.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatus.java new file mode 100644 index 0000000000000..bb0dadb8721fe --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatus.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.advisor.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The state of the Recommendation applicable from v2026-02-01-preview. + */ +public final class RecommendationStatus extends ExpandableStringEnum { + /** + * Static value New for RecommendationStatus. + */ + public static final RecommendationStatus NEW = fromString("New"); + + /** + * Static value Postponed for RecommendationStatus. + */ + public static final RecommendationStatus POSTPONED = fromString("Postponed"); + + /** + * Static value Dismissed for RecommendationStatus. + */ + public static final RecommendationStatus DISMISSED = fromString("Dismissed"); + + /** + * Static value Completed for RecommendationStatus. + */ + public static final RecommendationStatus COMPLETED = fromString("Completed"); + + /** + * Creates a new instance of RecommendationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RecommendationStatus() { + } + + /** + * Creates or finds a RecommendationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RecommendationStatus. + */ + public static RecommendationStatus fromString(String name) { + return fromString(name, RecommendationStatus.class); + } + + /** + * Gets known RecommendationStatus values. + * + * @return known RecommendationStatus values. + */ + public static Collection values() { + return values(RecommendationStatus.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Recommendations.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Recommendations.java index 5fad8e9b447ec..9527121179de7 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Recommendations.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Recommendations.java @@ -1,79 +1,127 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import java.util.UUID; /** * Resource collection API of Recommendations. */ public interface Recommendations { /** - * Initiates the recommendation generation or computation process for a subscription. This operation is - * asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * Obtains details of a cached recommendation. * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param recommendationId The recommendation 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 response. + * @return advisor Recommendation along with {@link Response}. */ - RecommendationsGenerateResponse generateWithResponse(Context context); + Response getWithResponse(String resourceUri, String recommendationId, Context context); /** - * Initiates the recommendation generation or computation process for a subscription. This operation is - * asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * Obtains details of a cached recommendation. * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param recommendationId The recommendation 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 advisor Recommendation. */ - void generate(); + ResourceRecommendationBase get(String resourceUri, String recommendationId); /** - * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the - * generation recommendation. The URI of this API is returned in the Location field of the response header. + * Update the state of a Recommendation. * - * @param operationId The operation ID, which can be found from the Location field in the generate recommendation - * response header. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. * @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}. + * @return advisor Recommendation along with {@link Response}. */ - Response getGenerateStatusWithResponse(UUID operationId, Context context); + Response updateWithResponse(String recommendationId, + RecommendationPatchPayload properties, Context context); /** - * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the - * generation recommendation. The URI of this API is returned in the Location field of the response header. + * Update the state of a Recommendation. * - * @param operationId The operation ID, which can be found from the Location field in the generate recommendation - * response header. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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 advisor Recommendation. + */ + ResourceRecommendationBase update(String recommendationId, RecommendationPatchPayload properties); + + /** + * Obtains recommendations for a subscription. + * + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Obtains recommendations for a subscription. + * + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'Critical'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. */ - void getGenerateStatus(UUID operationId); + PagedIterable list(String filter, RecommendationListMode mode, Integer top, + String skipToken, Context context); /** * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking * generateRecommendations. * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of Advisor recommendations as paginated response with {@link PagedIterable}. + * @return the response of a ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. */ - PagedIterable list(); + PagedIterable listByTenant(String resourceUri); /** * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking * generateRecommendations. * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. @@ -83,15 +131,60 @@ public interface Recommendations { * @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 list of Advisor recommendations as paginated response with {@link PagedIterable}. + * @return the response of a ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. */ - PagedIterable list(String filter, Integer top, String skipToken, Context context); + PagedIterable listByTenant(String resourceUri, String filter, Integer top, + String skipToken, Context context); /** - * Obtains details of a cached recommendation. + * Obtains recommendations for a service group. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param serviceGroupName The name of the service group. + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByServiceGroup(String serviceGroupName); + + /** + * Obtains recommendations for a service group. + * + * @param serviceGroupName The name of the service group. + * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties + * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', + * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', + * 'or', 'lt', 'gt', 'le', 'ge']<br>. + * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use + * `SubCategory` for filtering recommendation subcategory.<br> + * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and + * onwards.<br> + * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> + * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', + * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', + * 'ServiceUpgradeAndRetirement', 'Validation']<br> + * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq + * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le + * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'High'. + * @param mode The recommendation retrieval mode. + * @param top The number of recommendations per page. + * @param skipToken The page-continuation token for the next page. + * @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 ResourceRecommendationBase list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByServiceGroup(String serviceGroupName, String filter, + RecommendationListMode mode, Integer top, String skipToken, Context context); + + /** + * Obtains details of a recommendation for a service group. + * + * @param serviceGroupName The name of the service group. * @param recommendationId The recommendation ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -99,18 +192,94 @@ public interface Recommendations { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return advisor Recommendation along with {@link Response}. */ - Response getWithResponse(String resourceUri, String recommendationId, Context context); + Response getByServiceGroupWithResponse(String serviceGroupName, String recommendationId, + Context context); /** - * Obtains details of a cached recommendation. + * Obtains details of a recommendation for a service group. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param serviceGroupName The name of the service group. * @param recommendationId The recommendation 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 advisor Recommendation. */ - ResourceRecommendationBase get(String resourceUri, String recommendationId); + ResourceRecommendationBase getByServiceGroup(String serviceGroupName, String recommendationId); + + /** + * Updates the state of a recommendation for a service group. + * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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 advisor Recommendation along with {@link Response}. + */ + Response updateByServiceGroupWithResponse(String serviceGroupName, + String recommendationId, RecommendationPatchPayload properties, Context context); + + /** + * Updates the state of a recommendation for a service group. + * + * @param serviceGroupName The name of the service group. + * @param recommendationId The recommendation ID. + * @param properties The resource properties to be updated. + * @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 advisor Recommendation. + */ + ResourceRecommendationBase updateByServiceGroup(String serviceGroupName, String recommendationId, + RecommendationPatchPayload properties); + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is + * asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @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. + */ + RecommendationsGenerateResponse generateWithResponse(Context context); + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is + * asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @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 generate(); + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the + * generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. + * @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. + */ + RecommendationsGetGenerateStatusResponse getGenerateStatusWithResponse(String operationId, Context context); + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the + * generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation + * response header. + * @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 getGenerateStatus(String operationId); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateHeaders.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateHeaders.java index 2b9b3b2fcc018..66d4058bc4380 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateHeaders.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateHeaders.java @@ -1,27 +1,27 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; /** * The RecommendationsGenerateHeaders model. */ -@Fluent +@Immutable public final class RecommendationsGenerateHeaders { /* * The Retry-After property. */ - private String retryAfter; + private final Integer retryAfter; /* * The Location property. */ - private String location; + private final String location; // HttpHeaders containing the raw property values. /** @@ -30,7 +30,12 @@ public final class RecommendationsGenerateHeaders { * @param rawHeaders The raw HttpHeaders that will be used to create the property values. */ public RecommendationsGenerateHeaders(HttpHeaders rawHeaders) { - this.retryAfter = rawHeaders.getValue(HttpHeaderName.RETRY_AFTER); + String retryAfter = rawHeaders.getValue(HttpHeaderName.RETRY_AFTER); + if (retryAfter != null) { + this.retryAfter = Integer.parseInt(retryAfter); + } else { + this.retryAfter = null; + } this.location = rawHeaders.getValue(HttpHeaderName.LOCATION); } @@ -39,21 +44,10 @@ public RecommendationsGenerateHeaders(HttpHeaders rawHeaders) { * * @return the retryAfter value. */ - public String retryAfter() { + public Integer retryAfter() { return this.retryAfter; } - /** - * Set the retryAfter property: The Retry-After property. - * - * @param retryAfter the retryAfter value to set. - * @return the RecommendationsGenerateHeaders object itself. - */ - public RecommendationsGenerateHeaders withRetryAfter(String retryAfter) { - this.retryAfter = retryAfter; - return this; - } - /** * Get the location property: The Location property. * @@ -62,23 +56,4 @@ public RecommendationsGenerateHeaders withRetryAfter(String retryAfter) { public String location() { return this.location; } - - /** - * Set the location property: The Location property. - * - * @param location the location value to set. - * @return the RecommendationsGenerateHeaders object itself. - */ - public RecommendationsGenerateHeaders withLocation(String location) { - this.location = location; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateResponse.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateResponse.java index 7760dc61fbfa4..e037295b1129b 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateResponse.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateResponse.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusHeaders.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusHeaders.java new file mode 100644 index 0000000000000..a54433154099a --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusHeaders.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; + +/** + * The RecommendationsGetGenerateStatusHeaders model. + */ +@Immutable +public final class RecommendationsGetGenerateStatusHeaders { + /* + * The Retry-After property. + */ + private final Integer retryAfter; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of RecommendationsGetGenerateStatusHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public RecommendationsGetGenerateStatusHeaders(HttpHeaders rawHeaders) { + String retryAfter = rawHeaders.getValue(HttpHeaderName.RETRY_AFTER); + if (retryAfter != null) { + this.retryAfter = Integer.parseInt(retryAfter); + } else { + this.retryAfter = null; + } + } + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusResponse.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusResponse.java new file mode 100644 index 0000000000000..ca741d9ab68b4 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusResponse.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** + * Contains all response data for the getGenerateStatus operation. + */ +public final class RecommendationsGetGenerateStatusResponse + extends ResponseBase { + /** + * Creates an instance of RecommendationsGetGenerateStatusResponse. + * + * @param request the request which resulted in this RecommendationsGetGenerateStatusResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public RecommendationsGetGenerateStatusResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, + Void value, RecommendationsGetGenerateStatusHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReview.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReview.java new file mode 100644 index 0000000000000..f0dc7586c5b04 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReview.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewInner; + +/** + * An immutable client-side representation of ResiliencyReview. + */ +public interface ResiliencyReview { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the reviewName property: Review name. + * + * @return the reviewName value. + */ + String reviewName(); + + /** + * Gets the workloadName property: Workload Name. + * + * @return the workloadName value. + */ + String workloadName(); + + /** + * Gets the reviewStatus property: Review status. + * + * @return the reviewStatus value. + */ + ReviewStatus reviewStatus(); + + /** + * Gets the recommendationsCount property: Review recommendations count. + * + * @return the recommendationsCount value. + */ + Integer recommendationsCount(); + + /** + * Gets the publishedAt property: Review last updated timestamp. + * + * @return the publishedAt value. + */ + String publishedAt(); + + /** + * Gets the updatedAt property: Review last updated timestamp. + * + * @return the updatedAt value. + */ + String updatedAt(); + + /** + * Gets the inner com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewInner object. + * + * @return the inner object. + */ + ResiliencyReviewInner innerModel(); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReviews.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReviews.java new file mode 100644 index 0000000000000..3f0f32b8ce296 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReviews.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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 ResiliencyReviews. + */ +public interface ResiliencyReviews { + /** + * Get existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id. + * + * @param reviewId Existing review id. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @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 existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id along with {@link Response}. + */ + Response getWithResponse(String reviewId, Context context); + + /** + * Get existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id. + * + * @param reviewId Existing review id. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * @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 existing resiliency review. + * + * Get existing Azure Advisor resiliency review by id. + */ + ResiliencyReview get(String reviewId); + + /** + * Get list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews. + * + * @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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews. + * + * @param top The number of items to be included in the result. + * @param skip The number of items to skip before starting to collect the result set. + * @param filter The filter to apply.<br>Filter can be applied to properties ['reviewStatus', 'reviewId'] with + * operators ['eq', 'and', 'or'].<br>Example:<br>- $filter=reviewStatus eq 'New'. + * @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 list of resiliency reviews. + * + * Get list of Azure Advisor resiliency reviews as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Integer top, Integer skip, String filter, Context context); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceMetadata.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceMetadata.java index e3f385ac03bba..c082fc17e170f 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceMetadata.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceMetadata.java @@ -1,10 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -15,7 +16,7 @@ /** * Recommendation resource metadata. */ -@Fluent +@Immutable public final class ResourceMetadata implements JsonSerializable { /* * Azure resource Id of the assessed resource @@ -30,7 +31,7 @@ public final class ResourceMetadata implements JsonSerializable action; + private Map action; /* * The singular user friendly name of resource type. eg: virtual machine @@ -45,7 +46,7 @@ public final class ResourceMetadata implements JsonSerializable action() { + public Map action() { return this.action; } - /** - * Set the action property: The action to view resource. - * - * @param action the action value to set. - * @return the ResourceMetadata object itself. - */ - public ResourceMetadata withAction(Map action) { - this.action = action; - return this; - } - /** * Get the singular property: The singular user friendly name of resource type. eg: virtual machine. * @@ -117,17 +85,6 @@ public String singular() { return this.singular; } - /** - * Set the singular property: The singular user friendly name of resource type. eg: virtual machine. - * - * @param singular the singular value to set. - * @return the ResourceMetadata object itself. - */ - public ResourceMetadata withSingular(String singular) { - this.singular = singular; - return this; - } - /** * Get the plural property: The plural user friendly name of resource type. eg: virtual machines. * @@ -137,25 +94,6 @@ public String plural() { return this.plural; } - /** - * Set the plural property: The plural user friendly name of resource type. eg: virtual machines. - * - * @param plural the plural value to set. - * @return the ResourceMetadata object itself. - */ - public ResourceMetadata withPlural(String plural) { - this.plural = plural; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } - /** * {@inheritDoc} */ @@ -164,7 +102,13 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeStringField("resourceId", this.resourceId); jsonWriter.writeStringField("source", this.source); - jsonWriter.writeMapField("action", this.action, (writer, element) -> writer.writeUntyped(element)); + jsonWriter.writeMapField("action", this.action, (writer, element) -> { + if (element == null) { + writer.writeNull(); + } else { + element.writeTo(writer); + } + }); jsonWriter.writeStringField("singular", this.singular); jsonWriter.writeStringField("plural", this.plural); return jsonWriter.writeEndObject(); @@ -190,7 +134,8 @@ public static ResourceMetadata fromJson(JsonReader jsonReader) throws IOExceptio } else if ("source".equals(fieldName)) { deserializedResourceMetadata.source = reader.getString(); } else if ("action".equals(fieldName)) { - Map action = reader.readMap(reader1 -> reader1.readUntyped()); + Map action = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); deserializedResourceMetadata.action = action; } else if ("singular".equals(fieldName)) { deserializedResourceMetadata.singular = reader.getString(); diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceProviders.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceProviders.java new file mode 100644 index 0000000000000..4e8a0d0cfa352 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceProviders.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.advisor.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ResourceProviders. + */ +public interface ResourceProviders { + /** + * Predicts a recommendation. + * + * @param predictionRequest The request body. + * @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 response used by predictions along with {@link Response}. + */ + Response predictWithResponse(PredictionRequest predictionRequest, Context context); + + /** + * Predicts a recommendation. + * + * @param predictionRequest The request body. + * @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 response used by predictions. + */ + PredictionResponse predict(PredictionRequest predictionRequest); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationBase.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationBase.java index 75374f389acb4..a1e4637102257 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationBase.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationBase.java @@ -1,14 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; +import com.azure.core.management.SystemData; +import com.azure.core.util.BinaryData; import com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner; import java.time.OffsetDateTime; import java.util.List; import java.util.Map; -import java.util.UUID; /** * An immutable client-side representation of ResourceRecommendationBase. @@ -35,6 +36,13 @@ public interface ResourceRecommendationBase { */ String type(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the category property: The category of the recommendation. * @@ -42,6 +50,13 @@ public interface ResourceRecommendationBase { */ Category category(); + /** + * Gets the control property: The sub-category of the recommendation. + * + * @return the control value. + */ + Control control(); + /** * Gets the impact property: The business impact of the recommendation. * @@ -64,18 +79,97 @@ public interface ResourceRecommendationBase { String impactedValue(); /** - * Gets the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation. + * Gets the criticalityScore property: The criticality score assigned to the recommendation. + * + * @return the criticalityScore value. + */ + String criticalityScore(); + + /** + * Gets the criticality property: The criticality assigned to the recommendation. + * + * @return the criticality value. + */ + String criticality(); + + /** + * Gets the scoreChangedAt property: The time when the recommendation's criticality score last changed. + * + * @return the scoreChangedAt value. + */ + String scoreChangedAt(); + + /** + * Gets the serviceGroupId property: The service group ID associated with the recommendation. + * + * @return the serviceGroupId value. + */ + String serviceGroupId(); + + /** + * Gets the savings property: The estimated savings associated with the recommendation. + * + * @return the savings value. + */ + ResourceRecommendationSavings savings(); + + /** + * Gets the recommendationStatus property: The state of the Recommendation. + * + * @return the recommendationStatus value. + */ + RecommendationStatus recommendationStatus(); + + /** + * Gets the completionType property: The type of recommendation completion, which is either MarkedByUser or + * SystemVerified. + * + * @return the completionType value. + */ + String completionType(); + + /** + * Gets the recommendationDismissReason property: The reason the Recommendation was dismissed. + * + * @return the recommendationDismissReason value. + */ + RecommendationDismissReason recommendationDismissReason(); + + /** + * Gets the postponedUntilDateTime property: The time the Recommendation was postponed until. + * + * @return the postponedUntilDateTime value. + */ + OffsetDateTime postponedUntilDateTime(); + + /** + * Gets the lastRefreshed property: The most recent time Advisor evaluated the recommendation for validity + * (re-ingested). + * + * @return the lastRefreshed value. + */ + OffsetDateTime lastRefreshed(); + + /** + * Gets the lastUpdated property: The most recent time the recommendation state changed (manual or automated). * * @return the lastUpdated value. */ OffsetDateTime lastUpdated(); + /** + * Gets the createdTime property: The created time of the recommendation. + * + * @return the createdTime value. + */ + OffsetDateTime createdTime(); + /** * Gets the metadata property: The recommendation metadata. * * @return the metadata value. */ - Map metadata(); + Map metadata(); /** * Gets the recommendationTypeId property: The recommendation-type GUID. @@ -84,6 +178,13 @@ public interface ResourceRecommendationBase { */ String recommendationTypeId(); + /** + * Gets the risk property: The potential risk of not implementing the recommendation. + * + * @return the risk value. + */ + Risk risk(); + /** * Gets the shortDescription property: A summary of the recommendation. * @@ -92,11 +193,11 @@ public interface ResourceRecommendationBase { ShortDescription shortDescription(); /** - * Gets the suppressionIds property: The list of snoozed and dismissed rules for the recommendation. + * Gets the suppressionId property: The single snoozed or dismissed rule for the recommendation. * - * @return the suppressionIds value. + * @return the suppressionId value. */ - List suppressionIds(); + String suppressionId(); /** * Gets the extendedProperties property: Extended properties. @@ -145,14 +246,14 @@ public interface ResourceRecommendationBase { * * @return the actions value. */ - List> actions(); + List> actions(); /** * Gets the remediation property: The automated way to apply recommendation. * * @return the remediation value. */ - Map remediation(); + Map remediation(); /** * Gets the exposedMetadataProperties property: The recommendation metadata properties exposed to customer to @@ -160,7 +261,42 @@ public interface ResourceRecommendationBase { * * @return the exposedMetadataProperties value. */ - Map exposedMetadataProperties(); + Map exposedMetadataProperties(); + + /** + * Gets the trackedProperties property: The properties of a tracked recommendation. + * + * @return the trackedProperties value. + */ + TrackedRecommendationProperties trackedProperties(); + + /** + * Gets the review property: The Review that this Recommendation belongs to. + * + * @return the review value. + */ + RecommendationPropertiesReview review(); + + /** + * Gets the resourceWorkload property: The Workload that this Resource belongs to. + * + * @return the resourceWorkload value. + */ + RecommendationPropertiesResourceWorkload resourceWorkload(); + + /** + * Gets the sourceSystem property: The Source System that this Recommendation originated from. + * + * @return the sourceSystem value. + */ + String sourceSystem(); + + /** + * Gets the notes property: Additional notes for the Recommendation. + * + * @return the notes value. + */ + String notes(); /** * Gets the inner com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner object. diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavings.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavings.java new file mode 100644 index 0000000000000..cfde804800b80 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavings.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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; +import java.time.format.DateTimeFormatter; + +/** + * The estimated savings associated with a resource recommendation. + */ +@Immutable +public final class ResourceRecommendationSavings implements JsonSerializable { + /* + * The currency used by the recommendation provider. + */ + private String providerCurrency; + + /* + * The currency used for billing. + */ + private String billingCurrency; + + /* + * Indicates whether the recommendation is for a direct billing channel. + */ + private Boolean isDirectChannel; + + /* + * The time when the recommended resource was deleted. + */ + private OffsetDateTime resourceDeletedOn; + + /* + * The savings calculated using retail pricing. + */ + private ResourceRecommendationSavingsDetails retail; + + /* + * The savings calculated using contracted pricing. + */ + private ResourceRecommendationSavingsDetails contracted; + + /** + * Creates an instance of ResourceRecommendationSavings class. + */ + private ResourceRecommendationSavings() { + } + + /** + * Get the providerCurrency property: The currency used by the recommendation provider. + * + * @return the providerCurrency value. + */ + public String providerCurrency() { + return this.providerCurrency; + } + + /** + * Get the billingCurrency property: The currency used for billing. + * + * @return the billingCurrency value. + */ + public String billingCurrency() { + return this.billingCurrency; + } + + /** + * Get the isDirectChannel property: Indicates whether the recommendation is for a direct billing channel. + * + * @return the isDirectChannel value. + */ + public Boolean isDirectChannel() { + return this.isDirectChannel; + } + + /** + * Get the resourceDeletedOn property: The time when the recommended resource was deleted. + * + * @return the resourceDeletedOn value. + */ + public OffsetDateTime resourceDeletedOn() { + return this.resourceDeletedOn; + } + + /** + * Get the retail property: The savings calculated using retail pricing. + * + * @return the retail value. + */ + public ResourceRecommendationSavingsDetails retail() { + return this.retail; + } + + /** + * Get the contracted property: The savings calculated using contracted pricing. + * + * @return the contracted value. + */ + public ResourceRecommendationSavingsDetails contracted() { + return this.contracted; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("providerCurrency", this.providerCurrency); + jsonWriter.writeStringField("billingCurrency", this.billingCurrency); + jsonWriter.writeBooleanField("isDirectChannel", this.isDirectChannel); + jsonWriter.writeStringField("resourceDeletedOn", + this.resourceDeletedOn == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.resourceDeletedOn)); + jsonWriter.writeJsonField("retail", this.retail); + jsonWriter.writeJsonField("contracted", this.contracted); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceRecommendationSavings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceRecommendationSavings 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 ResourceRecommendationSavings. + */ + public static ResourceRecommendationSavings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceRecommendationSavings deserializedResourceRecommendationSavings + = new ResourceRecommendationSavings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("providerCurrency".equals(fieldName)) { + deserializedResourceRecommendationSavings.providerCurrency = reader.getString(); + } else if ("billingCurrency".equals(fieldName)) { + deserializedResourceRecommendationSavings.billingCurrency = reader.getString(); + } else if ("isDirectChannel".equals(fieldName)) { + deserializedResourceRecommendationSavings.isDirectChannel + = reader.getNullable(JsonReader::getBoolean); + } else if ("resourceDeletedOn".equals(fieldName)) { + deserializedResourceRecommendationSavings.resourceDeletedOn = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("retail".equals(fieldName)) { + deserializedResourceRecommendationSavings.retail + = ResourceRecommendationSavingsDetails.fromJson(reader); + } else if ("contracted".equals(fieldName)) { + deserializedResourceRecommendationSavings.contracted + = ResourceRecommendationSavingsDetails.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceRecommendationSavings; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavingsDetails.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavingsDetails.java new file mode 100644 index 0000000000000..3038b1ddceaef --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavingsDetails.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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 detailed savings amounts for a resource recommendation. + */ +@Immutable +public final class ResourceRecommendationSavingsDetails + implements JsonSerializable { + /* + * The potential savings in the provider currency. + */ + private Double potentialSavings; + + /* + * The potential savings in the billing currency. + */ + private Double potentialSavingsInBillingCurrency; + + /* + * The amount wasted to date in the provider currency. + */ + private Double wastedTillDate; + + /* + * The amount wasted to date in the billing currency. + */ + private Double wastedTillDateInBillingCurrency; + + /* + * The realized savings in the provider currency. + */ + private Double realizedSavings; + + /* + * The realized savings in the billing currency. + */ + private Double realizedSavingsInBillingCurrency; + + /** + * Creates an instance of ResourceRecommendationSavingsDetails class. + */ + private ResourceRecommendationSavingsDetails() { + } + + /** + * Get the potentialSavings property: The potential savings in the provider currency. + * + * @return the potentialSavings value. + */ + public Double potentialSavings() { + return this.potentialSavings; + } + + /** + * Get the potentialSavingsInBillingCurrency property: The potential savings in the billing currency. + * + * @return the potentialSavingsInBillingCurrency value. + */ + public Double potentialSavingsInBillingCurrency() { + return this.potentialSavingsInBillingCurrency; + } + + /** + * Get the wastedTillDate property: The amount wasted to date in the provider currency. + * + * @return the wastedTillDate value. + */ + public Double wastedTillDate() { + return this.wastedTillDate; + } + + /** + * Get the wastedTillDateInBillingCurrency property: The amount wasted to date in the billing currency. + * + * @return the wastedTillDateInBillingCurrency value. + */ + public Double wastedTillDateInBillingCurrency() { + return this.wastedTillDateInBillingCurrency; + } + + /** + * Get the realizedSavings property: The realized savings in the provider currency. + * + * @return the realizedSavings value. + */ + public Double realizedSavings() { + return this.realizedSavings; + } + + /** + * Get the realizedSavingsInBillingCurrency property: The realized savings in the billing currency. + * + * @return the realizedSavingsInBillingCurrency value. + */ + public Double realizedSavingsInBillingCurrency() { + return this.realizedSavingsInBillingCurrency; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("potentialSavings", this.potentialSavings); + jsonWriter.writeNumberField("potentialSavingsInBillingCurrency", this.potentialSavingsInBillingCurrency); + jsonWriter.writeNumberField("wastedTillDate", this.wastedTillDate); + jsonWriter.writeNumberField("wastedTillDateInBillingCurrency", this.wastedTillDateInBillingCurrency); + jsonWriter.writeNumberField("realizedSavings", this.realizedSavings); + jsonWriter.writeNumberField("realizedSavingsInBillingCurrency", this.realizedSavingsInBillingCurrency); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceRecommendationSavingsDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceRecommendationSavingsDetails 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 ResourceRecommendationSavingsDetails. + */ + public static ResourceRecommendationSavingsDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceRecommendationSavingsDetails deserializedResourceRecommendationSavingsDetails + = new ResourceRecommendationSavingsDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("potentialSavings".equals(fieldName)) { + deserializedResourceRecommendationSavingsDetails.potentialSavings + = reader.getNullable(JsonReader::getDouble); + } else if ("potentialSavingsInBillingCurrency".equals(fieldName)) { + deserializedResourceRecommendationSavingsDetails.potentialSavingsInBillingCurrency + = reader.getNullable(JsonReader::getDouble); + } else if ("wastedTillDate".equals(fieldName)) { + deserializedResourceRecommendationSavingsDetails.wastedTillDate + = reader.getNullable(JsonReader::getDouble); + } else if ("wastedTillDateInBillingCurrency".equals(fieldName)) { + deserializedResourceRecommendationSavingsDetails.wastedTillDateInBillingCurrency + = reader.getNullable(JsonReader::getDouble); + } else if ("realizedSavings".equals(fieldName)) { + deserializedResourceRecommendationSavingsDetails.realizedSavings + = reader.getNullable(JsonReader::getDouble); + } else if ("realizedSavingsInBillingCurrency".equals(fieldName)) { + deserializedResourceRecommendationSavingsDetails.realizedSavingsInBillingCurrency + = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceRecommendationSavingsDetails; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ReviewStatus.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ReviewStatus.java new file mode 100644 index 0000000000000..82a2b6b67b4e3 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ReviewStatus.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.advisor.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Review status. + */ +public final class ReviewStatus extends ExpandableStringEnum { + /** + * The review has been newly created. + */ + public static final ReviewStatus NEW = fromString("New"); + + /** + * The review is currently in progress. + */ + public static final ReviewStatus IN_PROGRESS = fromString("InProgress"); + + /** + * The review has been completed. + */ + public static final ReviewStatus COMPLETED = fromString("Completed"); + + /** + * Creates a new instance of ReviewStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ReviewStatus() { + } + + /** + * Creates or finds a ReviewStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReviewStatus. + */ + public static ReviewStatus fromString(String name) { + return fromString(name, ReviewStatus.class); + } + + /** + * Gets known ReviewStatus values. + * + * @return known ReviewStatus values. + */ + public static Collection values() { + return values(ReviewStatus.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Risk.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Risk.java new file mode 100644 index 0000000000000..8c4bf426ee3cb --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Risk.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.advisor.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The potential risk of not implementing the recommendation. + */ +public final class Risk extends ExpandableStringEnum { + /** + * Static value Error for Risk. + */ + public static final Risk ERROR = fromString("Error"); + + /** + * Static value Warning for Risk. + */ + public static final Risk WARNING = fromString("Warning"); + + /** + * Static value None for Risk. + */ + public static final Risk NONE = fromString("None"); + + /** + * Creates a new instance of Risk value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Risk() { + } + + /** + * Creates or finds a Risk from its string representation. + * + * @param name a name to look for. + * @return the corresponding Risk. + */ + public static Risk fromString(String name) { + return fromString(name, Risk.class); + } + + /** + * Gets known Risk values. + * + * @return known Risk values. + */ + public static Collection values() { + return values(Risk.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Scenario.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Scenario.java index 8152e8f5719a2..4e025da1ef3cc 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Scenario.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Scenario.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; @@ -8,7 +8,7 @@ import java.util.Collection; /** - * Defines values for Scenario. + * The list of scenarios applicable to this metadata entity. */ public final class Scenario extends ExpandableStringEnum { /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ScoreEntity.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ScoreEntity.java new file mode 100644 index 0000000000000..fa9f0349b8dca --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ScoreEntity.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.advisor.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 details of Advisor Score. + */ +@Immutable +public final class ScoreEntity implements JsonSerializable { + /* + * The date score was calculated. + */ + private String date; + + /* + * The percentage score. + */ + private Double score; + + /* + * The consumption units for the score. + */ + private Double consumptionUnits; + + /* + * The number of impacted resources. + */ + private Double impactedResourceCount; + + /* + * The potential percentage increase in overall score at subscription level once all recommendations in this scope + * are implemented. + */ + private Double potentialScoreIncrease; + + /* + * The count of impacted categories. + */ + private Double categoryCount; + + /** + * Creates an instance of ScoreEntity class. + */ + private ScoreEntity() { + } + + /** + * Get the date property: The date score was calculated. + * + * @return the date value. + */ + public String date() { + return this.date; + } + + /** + * Get the score property: The percentage score. + * + * @return the score value. + */ + public Double score() { + return this.score; + } + + /** + * Get the consumptionUnits property: The consumption units for the score. + * + * @return the consumptionUnits value. + */ + public Double consumptionUnits() { + return this.consumptionUnits; + } + + /** + * Get the impactedResourceCount property: The number of impacted resources. + * + * @return the impactedResourceCount value. + */ + public Double impactedResourceCount() { + return this.impactedResourceCount; + } + + /** + * Get the potentialScoreIncrease property: The potential percentage increase in overall score at subscription level + * once all recommendations in this scope are implemented. + * + * @return the potentialScoreIncrease value. + */ + public Double potentialScoreIncrease() { + return this.potentialScoreIncrease; + } + + /** + * Get the categoryCount property: The count of impacted categories. + * + * @return the categoryCount value. + */ + public Double categoryCount() { + return this.categoryCount; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("date", this.date); + jsonWriter.writeNumberField("score", this.score); + jsonWriter.writeNumberField("consumptionUnits", this.consumptionUnits); + jsonWriter.writeNumberField("impactedResourceCount", this.impactedResourceCount); + jsonWriter.writeNumberField("potentialScoreIncrease", this.potentialScoreIncrease); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScoreEntity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScoreEntity 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 ScoreEntity. + */ + public static ScoreEntity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScoreEntity deserializedScoreEntity = new ScoreEntity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("date".equals(fieldName)) { + deserializedScoreEntity.date = reader.getString(); + } else if ("score".equals(fieldName)) { + deserializedScoreEntity.score = reader.getNullable(JsonReader::getDouble); + } else if ("consumptionUnits".equals(fieldName)) { + deserializedScoreEntity.consumptionUnits = reader.getNullable(JsonReader::getDouble); + } else if ("impactedResourceCount".equals(fieldName)) { + deserializedScoreEntity.impactedResourceCount = reader.getNullable(JsonReader::getDouble); + } else if ("potentialScoreIncrease".equals(fieldName)) { + deserializedScoreEntity.potentialScoreIncrease = reader.getNullable(JsonReader::getDouble); + } else if ("categoryCount".equals(fieldName)) { + deserializedScoreEntity.categoryCount = reader.getNullable(JsonReader::getDouble); + } else { + reader.skipChildren(); + } + } + + return deserializedScoreEntity; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ShortDescription.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ShortDescription.java index 55228f2bd1b6b..d0e488e4a260a 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ShortDescription.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ShortDescription.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,7 +14,7 @@ /** * A summary of the recommendation. */ -@Fluent +@Immutable public final class ShortDescription implements JsonSerializable { /* * The issue or opportunity identified by the recommendation and proposed solution. @@ -29,7 +29,7 @@ public final class ShortDescription implements JsonSerializable getWithResponse(String resourceUri, String recomme /** * Obtains the details of a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -52,8 +50,7 @@ Response getWithResponse(String resourceUri, String recomme * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a * recommendation is referred to as a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @param context The context to associate with this operation. @@ -68,8 +65,7 @@ Response getWithResponse(String resourceUri, String recomme * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a * recommendation is referred to as a suppression. * - * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the - * recommendation applies. + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. * @param recommendationId The recommendation ID. * @param name The name of the suppression. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -84,7 +80,7 @@ Response getWithResponse(String resourceUri, String recomme * * @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 list of Advisor suppressions as paginated response with {@link PagedIterable}. + * @return the response of a SuppressionContract list operation as paginated response with {@link PagedIterable}. */ PagedIterable list(); @@ -98,7 +94,7 @@ Response getWithResponse(String resourceUri, String recomme * @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 list of Advisor suppressions as paginated response with {@link PagedIterable}. + * @return the response of a SuppressionContract list operation as paginated response with {@link PagedIterable}. */ PagedIterable list(Integer top, String skipToken, Context context); diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/TimeSeriesEntity.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/TimeSeriesEntity.java new file mode 100644 index 0000000000000..c97fc554176a7 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/TimeSeriesEntity.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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 historic data at different aggregation levels. + */ +@Immutable +public final class TimeSeriesEntity implements JsonSerializable { + /* + * The aggregation level of the score. + */ + private Aggregated aggregationLevel; + + /* + * The past score data + */ + private List scoreHistory; + + /** + * Creates an instance of TimeSeriesEntity class. + */ + private TimeSeriesEntity() { + } + + /** + * Get the aggregationLevel property: The aggregation level of the score. + * + * @return the aggregationLevel value. + */ + public Aggregated aggregationLevel() { + return this.aggregationLevel; + } + + /** + * Get the scoreHistory property: The past score data. + * + * @return the scoreHistory value. + */ + public List scoreHistory() { + return this.scoreHistory; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("aggregationLevel", + this.aggregationLevel == null ? null : this.aggregationLevel.toString()); + jsonWriter.writeArrayField("scoreHistory", this.scoreHistory, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TimeSeriesEntity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TimeSeriesEntity 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 TimeSeriesEntity. + */ + public static TimeSeriesEntity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TimeSeriesEntity deserializedTimeSeriesEntity = new TimeSeriesEntity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("aggregationLevel".equals(fieldName)) { + deserializedTimeSeriesEntity.aggregationLevel = Aggregated.fromString(reader.getString()); + } else if ("scoreHistory".equals(fieldName)) { + List scoreHistory = reader.readArray(reader1 -> ScoreEntity.fromJson(reader1)); + deserializedTimeSeriesEntity.scoreHistory = scoreHistory; + } else { + reader.skipChildren(); + } + } + + return deserializedTimeSeriesEntity; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/TrackedRecommendationProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/TrackedRecommendationProperties.java new file mode 100644 index 0000000000000..7317fb9fabbf4 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/TrackedRecommendationProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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 tracked properties of a Recommendation. + */ +@Immutable +public final class TrackedRecommendationProperties implements JsonSerializable { + /* + * The Priority of the Recommendation. + */ + private Priority priority; + + /** + * Creates an instance of TrackedRecommendationProperties class. + */ + private TrackedRecommendationProperties() { + } + + /** + * Get the priority property: The Priority of the Recommendation. + * + * @return the priority value. + */ + public Priority priority() { + return this.priority; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("priority", this.priority == null ? null : this.priority.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TrackedRecommendationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TrackedRecommendationProperties 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 TrackedRecommendationProperties. + */ + public static TrackedRecommendationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TrackedRecommendationProperties deserializedTrackedRecommendationProperties + = new TrackedRecommendationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("priority".equals(fieldName)) { + deserializedTrackedRecommendationProperties.priority = Priority.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTrackedRecommendationProperties; + }); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/WorkloadResult.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/WorkloadResult.java new file mode 100644 index 0000000000000..ce18791ef7815 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/WorkloadResult.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.resourcemanager.advisor.fluent.models.WorkloadResultInner; + +/** + * An immutable client-side representation of WorkloadResult. + */ +public interface WorkloadResult { + /** + * Gets the id property: Workload Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Workload Name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the subscriptionId property: Subscription Id. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the subscriptionName property: Subscription Name. + * + * @return the subscriptionName value. + */ + String subscriptionName(); + + /** + * Gets the inner com.azure.resourcemanager.advisor.fluent.models.WorkloadResultInner object. + * + * @return the inner object. + */ + WorkloadResultInner innerModel(); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Workloads.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Workloads.java new file mode 100644 index 0000000000000..8e607fe8cdc59 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/Workloads.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Workloads. + */ +public interface Workloads { + /** + * Get Workloads list. + * + * Get list of Workloads. + * + * @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 workloads list. + * + * Get list of Workloads as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get Workloads list. + * + * Get list of Workloads. + * + * @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 workloads list. + * + * Get list of Workloads as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/package-info.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/package-info.java index 75e290de332a1..d414a3b1ae986 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/package-info.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the data models for AdvisorManagementClient. - * REST APIs for Azure Advisor. + * Package containing the data models for Advisor. + * REST APIs for Azure Advisor Resiliency Reviews. */ package com.azure.resourcemanager.advisor.models; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/package-info.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/package-info.java index 0ac51ed23782b..d58cc5da10bff 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/package-info.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the classes for AdvisorManagementClient. - * REST APIs for Azure Advisor. + * Package containing the classes for Advisor. + * REST APIs for Azure Advisor Resiliency Reviews. */ package com.azure.resourcemanager.advisor; diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/module-info.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/module-info.java index e74b563bb8872..d70ef888d7595 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/module-info.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/module-info.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. module com.azure.resourcemanager.advisor { requires transitive com.azure.core.management; @@ -12,4 +12,5 @@ opens com.azure.resourcemanager.advisor.fluent.models to com.azure.core; opens com.azure.resourcemanager.advisor.models to com.azure.core; + opens com.azure.resourcemanager.advisor.implementation.models to com.azure.core; } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/azure-resourcemanager-advisor_metadata.json b/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/azure-resourcemanager-advisor_metadata.json new file mode 100644 index 0000000000000..8517000c10860 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/azure-resourcemanager-advisor_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Microsoft.Advisor":"2026-08-01-preview"},"crossLanguagePackageId":"Microsoft.Advisor","crossLanguageVersion":"9a5b662d75e4","crossLanguageDefinitions":{"com.azure.resourcemanager.advisor.fluent.AdvisorManagementClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient.get":"Microsoft.Advisor.AdvisorScoreEntities.get","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient.getWithResponse":"Microsoft.Advisor.AdvisorScoreEntities.get","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient.list":"Microsoft.Advisor.AdvisorScoreEntities.list","com.azure.resourcemanager.advisor.fluent.AssessmentTypesClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AssessmentTypesClient.list":"Microsoft.Advisor.AssessmentTypesOperationGroup.list","com.azure.resourcemanager.advisor.fluent.AssessmentsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.delete":"Microsoft.Advisor.AssessmentResults.delete","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.deleteWithResponse":"Microsoft.Advisor.AssessmentResults.delete","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.get":"Microsoft.Advisor.AssessmentResults.get","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.getWithResponse":"Microsoft.Advisor.AssessmentResults.get","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.list":"Microsoft.Advisor.AssessmentResults.list","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.put":"Microsoft.Advisor.AssessmentResults.put","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.putWithResponse":"Microsoft.Advisor.AssessmentResults.put","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInResourceGroup":"Microsoft.Advisor.ConfigurationsOperationGroup.createInResourceGroup","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInResourceGroupWithResponse":"Microsoft.Advisor.ConfigurationsOperationGroup.createInResourceGroup","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInSubscription":"Microsoft.Advisor.ConfigurationsOperationGroup.createInSubscription","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInSubscriptionWithResponse":"Microsoft.Advisor.ConfigurationsOperationGroup.createInSubscription","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.list":"Microsoft.Advisor.ConfigurationsOperationGroup.listBySubscription","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.listByResourceGroup":"Microsoft.Advisor.ConfigurationsOperationGroup.listByResourceGroup","com.azure.resourcemanager.advisor.fluent.OperationsClient":"Microsoft.Advisor.Operations","com.azure.resourcemanager.advisor.fluent.OperationsClient.list":"Azure.ResourceManager.Legacy.Operations.list","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient.get":"Microsoft.Advisor.MetadataEntities.get","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient.getWithResponse":"Microsoft.Advisor.MetadataEntities.get","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient.list":"Microsoft.Advisor.MetadataEntities.list","com.azure.resourcemanager.advisor.fluent.RecommendationsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.generate":"Microsoft.Advisor.RecommendationsOperationGroup.generate","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.generateWithResponse":"Microsoft.Advisor.RecommendationsOperationGroup.generate","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.get":"Microsoft.Advisor.ResourceRecommendationBases.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getByServiceGroup":"Microsoft.Advisor.ServiceGroupRecommendations.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getByServiceGroupWithResponse":"Microsoft.Advisor.ServiceGroupRecommendations.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getGenerateStatus":"Microsoft.Advisor.RecommendationsOperationGroup.getGenerateStatus","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getGenerateStatusWithResponse":"Microsoft.Advisor.RecommendationsOperationGroup.getGenerateStatus","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getWithResponse":"Microsoft.Advisor.ResourceRecommendationBases.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.list":"Microsoft.Advisor.ResourceRecommendationBases.list","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.listByServiceGroup":"Microsoft.Advisor.ServiceGroupRecommendations.list","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.listByTenant":"Microsoft.Advisor.ResourceRecommendationBases.listByTenant","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.update":"Microsoft.Advisor.ResourceRecommendationBases.update","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.updateByServiceGroup":"Microsoft.Advisor.ServiceGroupRecommendations.update","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.updateByServiceGroupWithResponse":"Microsoft.Advisor.ServiceGroupRecommendations.update","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.updateWithResponse":"Microsoft.Advisor.ResourceRecommendationBases.update","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient.get":"Microsoft.Advisor.ResiliencyReviews.get","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient.getWithResponse":"Microsoft.Advisor.ResiliencyReviews.get","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient.list":"Microsoft.Advisor.ResiliencyReviews.list","com.azure.resourcemanager.advisor.fluent.ResourceProvidersClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.ResourceProvidersClient.predict":"Microsoft.Advisor.predict","com.azure.resourcemanager.advisor.fluent.ResourceProvidersClient.predictWithResponse":"Microsoft.Advisor.predict","com.azure.resourcemanager.advisor.fluent.SuppressionsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.create":"Microsoft.Advisor.SuppressionContracts.create","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.createWithResponse":"Microsoft.Advisor.SuppressionContracts.create","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.delete":"Microsoft.Advisor.SuppressionContracts.delete","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.deleteWithResponse":"Microsoft.Advisor.SuppressionContracts.delete","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.get":"Microsoft.Advisor.SuppressionContracts.get","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.getWithResponse":"Microsoft.Advisor.SuppressionContracts.get","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.list":"Microsoft.Advisor.SuppressionsOperationGroup.list","com.azure.resourcemanager.advisor.fluent.WorkloadsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.WorkloadsClient.list":"Microsoft.Advisor.WorkloadsOperationGroup.list","com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner":"Microsoft.Advisor.AdvisorScoreEntity","com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityProperties":"Microsoft.Advisor.AdvisorScoreEntityProperties","com.azure.resourcemanager.advisor.fluent.models.AssessmentResultInner":"Microsoft.Advisor.AssessmentResult","com.azure.resourcemanager.advisor.fluent.models.AssessmentResultProperties":"Microsoft.Advisor.AssessmentResultProperties","com.azure.resourcemanager.advisor.fluent.models.AssessmentTypeResultInner":"Microsoft.Advisor.AssessmentTypeResult","com.azure.resourcemanager.advisor.fluent.models.ConfigDataInner":"Microsoft.Advisor.ConfigData","com.azure.resourcemanager.advisor.fluent.models.ConfigDataProperties":"Microsoft.Advisor.ConfigDataProperties","com.azure.resourcemanager.advisor.fluent.models.MetadataEntityInner":"Microsoft.Advisor.MetadataEntity","com.azure.resourcemanager.advisor.fluent.models.MetadataEntityProperties":"Microsoft.Advisor.MetadataEntityProperties","com.azure.resourcemanager.advisor.fluent.models.OperationEntityInner":"Microsoft.Advisor.OperationEntity","com.azure.resourcemanager.advisor.fluent.models.PredictionRequestProperties":"Microsoft.Advisor.PredictionRequestProperties","com.azure.resourcemanager.advisor.fluent.models.PredictionResponseInner":"Microsoft.Advisor.PredictionResponse","com.azure.resourcemanager.advisor.fluent.models.PredictionResponseProperties":"Microsoft.Advisor.PredictionResponseProperties","com.azure.resourcemanager.advisor.fluent.models.RecommendationProperties":"Microsoft.Advisor.RecommendationProperties","com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewInner":"Microsoft.Advisor.ResiliencyReview","com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewProperties":"Microsoft.Advisor.ResiliencyReviewProperties","com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner":"Microsoft.Advisor.ResourceRecommendationBase","com.azure.resourcemanager.advisor.fluent.models.SuppressionContractInner":"Microsoft.Advisor.SuppressionContract","com.azure.resourcemanager.advisor.fluent.models.SuppressionProperties":"Microsoft.Advisor.SuppressionProperties","com.azure.resourcemanager.advisor.fluent.models.WorkloadResultInner":"Microsoft.Advisor.WorkloadResult","com.azure.resourcemanager.advisor.implementation.AdvisorManagementClientBuilder":"Microsoft.Advisor","com.azure.resourcemanager.advisor.implementation.models.AdvisorScoreResponse":"Microsoft.Advisor.AdvisorScoreResponse","com.azure.resourcemanager.advisor.implementation.models.AssessmentListResult":"Microsoft.Advisor.AssessmentListResult","com.azure.resourcemanager.advisor.implementation.models.AssessmentTypeListResult":"Microsoft.Advisor.AssessmentTypeListResult","com.azure.resourcemanager.advisor.implementation.models.ConfigurationListResult":"Microsoft.Advisor.ConfigurationListResult","com.azure.resourcemanager.advisor.implementation.models.MetadataEntityListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.advisor.implementation.models.OperationEntityListResult":"Microsoft.Advisor.OperationEntityListResult","com.azure.resourcemanager.advisor.implementation.models.ResiliencyReviewCollection":"Microsoft.Advisor.ResiliencyReviewCollection","com.azure.resourcemanager.advisor.implementation.models.ResourceRecommendationBaseListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.advisor.implementation.models.SuppressionContractListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.advisor.implementation.models.WorkloadListResult":"Microsoft.Advisor.WorkloadListResult","com.azure.resourcemanager.advisor.models.Aggregated":"Microsoft.Advisor.Aggregated","com.azure.resourcemanager.advisor.models.Category":"Microsoft.Advisor.Category","com.azure.resourcemanager.advisor.models.ConfigurationName":"Microsoft.Advisor.ConfigurationName","com.azure.resourcemanager.advisor.models.Control":"Microsoft.Advisor.Control","com.azure.resourcemanager.advisor.models.CpuThreshold":"Microsoft.Advisor.CpuThreshold","com.azure.resourcemanager.advisor.models.DigestConfig":"Microsoft.Advisor.DigestConfig","com.azure.resourcemanager.advisor.models.DigestConfigState":"Microsoft.Advisor.DigestConfigState","com.azure.resourcemanager.advisor.models.DurationModel":"Microsoft.Advisor.Duration","com.azure.resourcemanager.advisor.models.Impact":"Microsoft.Advisor.Impact","com.azure.resourcemanager.advisor.models.MetadataSupportedValueDetail":"Microsoft.Advisor.MetadataSupportedValueDetail","com.azure.resourcemanager.advisor.models.OperationDisplayInfo":"Microsoft.Advisor.OperationDisplayInfo","com.azure.resourcemanager.advisor.models.PredictionRequest":"Microsoft.Advisor.PredictionRequest","com.azure.resourcemanager.advisor.models.PredictionType":"Microsoft.Advisor.PredictionType","com.azure.resourcemanager.advisor.models.Priority":"Microsoft.Advisor.Priority","com.azure.resourcemanager.advisor.models.RecommendationDismissReason":"Microsoft.Advisor.RecommendationDismissReason","com.azure.resourcemanager.advisor.models.RecommendationListMode":"Microsoft.Advisor.RecommendationListMode","com.azure.resourcemanager.advisor.models.RecommendationPatchPayload":"Microsoft.Advisor.RecommendationPatchPayload","com.azure.resourcemanager.advisor.models.RecommendationPropertiesResourceWorkload":"Microsoft.Advisor.RecommendationPropertiesResourceWorkload","com.azure.resourcemanager.advisor.models.RecommendationPropertiesReview":"Microsoft.Advisor.RecommendationPropertiesReview","com.azure.resourcemanager.advisor.models.RecommendationStatePropertiesPayload":"Microsoft.Advisor.RecommendationStatePropertiesPayload","com.azure.resourcemanager.advisor.models.RecommendationStatus":"Microsoft.Advisor.RecommendationStatus","com.azure.resourcemanager.advisor.models.RecommendationsGenerateHeaders":null,"com.azure.resourcemanager.advisor.models.RecommendationsGetGenerateStatusHeaders":null,"com.azure.resourcemanager.advisor.models.ResourceMetadata":"Microsoft.Advisor.ResourceMetadata","com.azure.resourcemanager.advisor.models.ResourceRecommendationSavings":"Microsoft.Advisor.ResourceRecommendationSavings","com.azure.resourcemanager.advisor.models.ResourceRecommendationSavingsDetails":"Microsoft.Advisor.ResourceRecommendationSavingsDetails","com.azure.resourcemanager.advisor.models.ReviewStatus":"Microsoft.Advisor.ReviewStatus","com.azure.resourcemanager.advisor.models.Risk":"Microsoft.Advisor.Risk","com.azure.resourcemanager.advisor.models.Scenario":"Microsoft.Advisor.Scenario","com.azure.resourcemanager.advisor.models.ScoreEntity":"Microsoft.Advisor.ScoreEntity","com.azure.resourcemanager.advisor.models.ShortDescription":"Microsoft.Advisor.ShortDescription","com.azure.resourcemanager.advisor.models.TimeSeriesEntity":"Microsoft.Advisor.TimeSeriesEntity","com.azure.resourcemanager.advisor.models.TrackedRecommendationProperties":"Microsoft.Advisor.TrackedRecommendationProperties"},"generatedFiles":["src/main/java/com/azure/resourcemanager/advisor/AdvisorManager.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorManagementClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorScoresClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentTypesClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/ConfigurationsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationMetadatasClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/ResiliencyReviewsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/ResourceProvidersClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/SuppressionsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/WorkloadsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentTypeResultInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/OperationEntityInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionRequestProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/RecommendationProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResourceRecommendationBaseInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionContractInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/WorkloadResultInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/advisor/fluent/package-info.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoreEntityImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentResultImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypeResultImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/MetadataEntityImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/OperationEntityImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/PredictionResponseImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceRecommendationBaseImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadResultImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/AdvisorScoreResponse.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentTypeListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/ConfigurationListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/MetadataEntityListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/OperationEntityListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResiliencyReviewCollection.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResourceRecommendationBaseListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/SuppressionContractListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/WorkloadListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/package-info.java","src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScores.java","src/main/java/com/azure/resourcemanager/advisor/models/Aggregated.java","src/main/java/com/azure/resourcemanager/advisor/models/AssessmentResult.java","src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypeResult.java","src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypes.java","src/main/java/com/azure/resourcemanager/advisor/models/Assessments.java","src/main/java/com/azure/resourcemanager/advisor/models/Category.java","src/main/java/com/azure/resourcemanager/advisor/models/ConfigData.java","src/main/java/com/azure/resourcemanager/advisor/models/ConfigurationName.java","src/main/java/com/azure/resourcemanager/advisor/models/Configurations.java","src/main/java/com/azure/resourcemanager/advisor/models/Control.java","src/main/java/com/azure/resourcemanager/advisor/models/CpuThreshold.java","src/main/java/com/azure/resourcemanager/advisor/models/DigestConfig.java","src/main/java/com/azure/resourcemanager/advisor/models/DigestConfigState.java","src/main/java/com/azure/resourcemanager/advisor/models/DurationModel.java","src/main/java/com/azure/resourcemanager/advisor/models/Impact.java","src/main/java/com/azure/resourcemanager/advisor/models/MetadataEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/MetadataSupportedValueDetail.java","src/main/java/com/azure/resourcemanager/advisor/models/OperationDisplayInfo.java","src/main/java/com/azure/resourcemanager/advisor/models/OperationEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/Operations.java","src/main/java/com/azure/resourcemanager/advisor/models/PredictionRequest.java","src/main/java/com/azure/resourcemanager/advisor/models/PredictionResponse.java","src/main/java/com/azure/resourcemanager/advisor/models/PredictionType.java","src/main/java/com/azure/resourcemanager/advisor/models/Priority.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationDismissReason.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationListMode.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationMetadatas.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPatchPayload.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesResourceWorkload.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesReview.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatePropertiesPayload.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatus.java","src/main/java/com/azure/resourcemanager/advisor/models/Recommendations.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateHeaders.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateResponse.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusHeaders.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusResponse.java","src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReview.java","src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReviews.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceMetadata.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceProviders.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationBase.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavings.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavingsDetails.java","src/main/java/com/azure/resourcemanager/advisor/models/ReviewStatus.java","src/main/java/com/azure/resourcemanager/advisor/models/Risk.java","src/main/java/com/azure/resourcemanager/advisor/models/Scenario.java","src/main/java/com/azure/resourcemanager/advisor/models/ScoreEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/ShortDescription.java","src/main/java/com/azure/resourcemanager/advisor/models/SuppressionContract.java","src/main/java/com/azure/resourcemanager/advisor/models/Suppressions.java","src/main/java/com/azure/resourcemanager/advisor/models/TimeSeriesEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/TrackedRecommendationProperties.java","src/main/java/com/azure/resourcemanager/advisor/models/WorkloadResult.java","src/main/java/com/azure/resourcemanager/advisor/models/Workloads.java","src/main/java/com/azure/resourcemanager/advisor/models/package-info.java","src/main/java/com/azure/resourcemanager/advisor/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-advisor/proxy-config.json b/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-advisor/proxy-config.json index ba5a1b9a7a3b1..5b9880d4d11c0 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-advisor/proxy-config.json +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-advisor/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.advisor.implementation.ConfigurationsClientImpl$ConfigurationsService"],["com.azure.resourcemanager.advisor.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.advisor.implementation.RecommendationMetadatasClientImpl$RecommendationMetadatasService"],["com.azure.resourcemanager.advisor.implementation.RecommendationsClientImpl$RecommendationsService"],["com.azure.resourcemanager.advisor.implementation.SuppressionsClientImpl$SuppressionsService"]] \ No newline at end of file +[["com.azure.resourcemanager.advisor.implementation.AdvisorScoresClientImpl$AdvisorScoresService"],["com.azure.resourcemanager.advisor.implementation.AssessmentTypesClientImpl$AssessmentTypesService"],["com.azure.resourcemanager.advisor.implementation.AssessmentsClientImpl$AssessmentsService"],["com.azure.resourcemanager.advisor.implementation.ConfigurationsClientImpl$ConfigurationsService"],["com.azure.resourcemanager.advisor.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.advisor.implementation.RecommendationMetadatasClientImpl$RecommendationMetadatasService"],["com.azure.resourcemanager.advisor.implementation.RecommendationsClientImpl$RecommendationsService"],["com.azure.resourcemanager.advisor.implementation.ResiliencyReviewsClientImpl$ResiliencyReviewsService"],["com.azure.resourcemanager.advisor.implementation.ResourceProvidersClientImpl$ResourceProvidersService"],["com.azure.resourcemanager.advisor.implementation.SuppressionsClientImpl$SuppressionsService"],["com.azure.resourcemanager.advisor.implementation.WorkloadsClientImpl$WorkloadsService"]] \ No newline at end of file diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/azure-resourcemanager-advisor.properties b/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/azure-resourcemanager-advisor.properties new file mode 100644 index 0000000000000..defbd48204e47 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/azure-resourcemanager-advisor.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresGetSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresGetSamples.java new file mode 100644 index 0000000000000..124f5eeee9379 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresGetSamples.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.advisor.generated; + +/** + * Samples for AdvisorScores Get. + */ +public final class AdvisorScoresGetSamples { + /* + * x-ms-original-file: 2026-08-01-preview/GetAdvisorScoreDetail.json + */ + /** + * Sample code: GetAdvisorScoreDetail. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getAdvisorScoreDetail(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.advisorScores().getWithResponse("Cost", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresListSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresListSamples.java new file mode 100644 index 0000000000000..788302508c134 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresListSamples.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.advisor.generated; + +/** + * Samples for AdvisorScores List. + */ +public final class AdvisorScoresListSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListAdvisorScore.json + */ + /** + * Sample code: ListAdvisorScore. + * + * @param manager Entry point to AdvisorManager. + */ + public static void listAdvisorScore(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.advisorScores().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentTypesListSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentTypesListSamples.java new file mode 100644 index 0000000000000..5fddf595e74c6 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentTypesListSamples.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.advisor.generated; + +/** + * Samples for AssessmentTypes List. + */ +public final class AssessmentTypesListSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListAssessmentTypes.json + */ + /** + * Sample code: GetAssessmentTypes. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getAssessmentTypes(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.assessmentTypes().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsDeleteSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsDeleteSamples.java new file mode 100644 index 0000000000000..edc7172786cd4 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsDeleteSamples.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.advisor.generated; + +/** + * Samples for Assessments Delete. + */ +public final class AssessmentsDeleteSamples { + /* + * x-ms-original-file: 2026-08-01-preview/DeleteAssessment.json + */ + /** + * Sample code: DeleteAssessment. + * + * @param manager Entry point to AdvisorManager. + */ + public static void deleteAssessment(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.assessments().deleteWithResponse("assessment1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsGetSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsGetSamples.java new file mode 100644 index 0000000000000..e6e7b8825ac55 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsGetSamples.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.advisor.generated; + +/** + * Samples for Assessments Get. + */ +public final class AssessmentsGetSamples { + /* + * x-ms-original-file: 2026-08-01-preview/GetAssessment.json + */ + /** + * Sample code: GetAssessment. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getAssessment(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.assessments().getWithResponse("assessment1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsListSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsListSamples.java new file mode 100644 index 0000000000000..922aab9493a1c --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsListSamples.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.advisor.generated; + +/** + * Samples for Assessments List. + */ +public final class AssessmentsListSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListAssessments.json + */ + /** + * Sample code: ListAssessments. + * + * @param manager Entry point to AdvisorManager. + */ + public static void listAssessments(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.assessments().list(null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsPutSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsPutSamples.java new file mode 100644 index 0000000000000..24c00255582b5 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AssessmentsPutSamples.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.advisor.generated; + +/** + * Samples for Assessments Put. + */ +public final class AssessmentsPutSamples { + /* + * x-ms-original-file: 2026-08-01-preview/PutAssessment.json + */ + /** + * Sample code: PutAssessment. + * + * @param manager Entry point to AdvisorManager. + */ + public static void putAssessment(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.assessments() + .define("assessment1") + .withWorkloadId("f72b7134-800f-4f1b-a5bd-691e2140c7d5") + .withTypeId("23513bdb-e8a2-4f0b-8b6b-191ee1f52d34") + .withLocale("en-us") + .create(); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInResourceGroupSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInResourceGroupSamples.java index 890ad87ad7e19..5b127a9d3f81c 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInResourceGroupSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInResourceGroupSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,6 +9,7 @@ import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfig; import com.azure.resourcemanager.advisor.models.DigestConfigState; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.util.Arrays; /** @@ -16,8 +17,7 @@ */ public final class ConfigurationsCreateInResourceGroupSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/CreateConfiguration.json + * x-ms-original-file: 2026-08-01-preview/CreateConfiguration.json */ /** * Sample code: PutConfigurations. @@ -30,9 +30,10 @@ public static void putConfigurations(com.azure.resourcemanager.advisor.AdvisorMa .withExistingResourceGroup("resourceGroup") .withExclude(true) .withLowCpuThreshold(CpuThreshold.FIVE) + .withDuration(DurationModel.SEVEN) .withDigests(Arrays.asList(new DigestConfig().withName("digestConfigName") .withActionGroupResourceId( - "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName") + "/subscriptions/58c3f667-7a62-4bfd-a658-846493e9a493/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName") .withFrequency(30) .withCategories(Arrays.asList(Category.HIGH_AVAILABILITY, Category.SECURITY, Category.PERFORMANCE, Category.COST, Category.OPERATIONAL_EXCELLENCE)) diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInSubscriptionSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInSubscriptionSamples.java index 6b5f9fab2c130..7bd992bc21c9f 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInSubscriptionSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInSubscriptionSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -10,6 +10,7 @@ import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfig; import com.azure.resourcemanager.advisor.models.DigestConfigState; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.util.Arrays; /** @@ -17,8 +18,7 @@ */ public final class ConfigurationsCreateInSubscriptionSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/CreateConfiguration.json + * x-ms-original-file: 2026-08-01-preview/CreateConfiguration_CreateInSubscription.json */ /** * Sample code: PutConfigurations. @@ -29,9 +29,10 @@ public static void putConfigurations(com.azure.resourcemanager.advisor.AdvisorMa manager.configurations() .createInSubscriptionWithResponse(ConfigurationName.DEFAULT, new ConfigDataInner().withExclude(true) .withLowCpuThreshold(CpuThreshold.FIVE) + .withDuration(DurationModel.SEVEN) .withDigests(Arrays.asList(new DigestConfig().withName("digestConfigName") .withActionGroupResourceId( - "/subscriptions/subscriptionId/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName") + "/subscriptions/58c3f667-7a62-4bfd-a658-846493e9a493/resourceGroups/resourceGroup/providers/microsoft.insights/actionGroups/actionGroupName") .withFrequency(30) .withCategories(Arrays.asList(Category.HIGH_AVAILABILITY, Category.SECURITY, Category.PERFORMANCE, Category.COST, Category.OPERATIONAL_EXCELLENCE)) diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListByResourceGroupSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListByResourceGroupSamples.java index 753bfd33e9feb..6f6d572cde915 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListByResourceGroupSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListByResourceGroupSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,8 +9,7 @@ */ public final class ConfigurationsListByResourceGroupSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListConfigurations.json + * x-ms-original-file: 2026-08-01-preview/ListConfigurations.json */ /** * Sample code: GetConfigurations. diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListSamples.java index b3eba2a41274a..0d6efbb0424c1 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,8 +9,7 @@ */ public final class ConfigurationsListSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListConfigurations.json + * x-ms-original-file: 2026-08-01-preview/ListConfigurations_ListBySubscription.json */ /** * Sample code: GetConfigurations. diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/OperationsListSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/OperationsListSamples.java index e5d0c0cc6fa62..36949766044a0 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/OperationsListSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/OperationsListSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,15 +9,14 @@ */ public final class OperationsListSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListOperations.json + * x-ms-original-file: 2026-08-01-preview/OperationsList.json */ /** - * Sample code: ListRecommendations. + * Sample code: OperationsList. * * @param manager Entry point to AdvisorManager. */ - public static void listRecommendations(com.azure.resourcemanager.advisor.AdvisorManager manager) { + public static void operationsList(com.azure.resourcemanager.advisor.AdvisorManager manager) { manager.operations().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadataGetSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadataGetSamples.java index 0870ad8e4827e..37b239e530a14 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadataGetSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadataGetSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,8 +9,7 @@ */ public final class RecommendationMetadataGetSamples { /* - * x-ms-original-file: specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ - * GetRecommendationMetadataEntity.json + * x-ms-original-file: 2026-08-01-preview/GetRecommendationMetadataEntity.json */ /** * Sample code: GetMetadata. diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadataListSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadataListSamples.java index a323f67468e3b..95e8169703c7d 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadataListSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadataListSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,9 +9,7 @@ */ public final class RecommendationMetadataListSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListRecommendationMetadata. - * json + * x-ms-original-file: 2026-08-01-preview/ListRecommendationMetadata.json */ /** * Sample code: GetMetadata. @@ -19,6 +17,6 @@ public final class RecommendationMetadataListSamples { * @param manager Entry point to AdvisorManager. */ public static void getMetadata(com.azure.resourcemanager.advisor.AdvisorManager manager) { - manager.recommendationMetadatas().list(com.azure.core.util.Context.NONE); + manager.recommendationMetadatas().list(null, com.azure.core.util.Context.NONE); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGenerateSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGenerateSamples.java index 10ff36f412d56..67a974c3f1ecc 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGenerateSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGenerateSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,8 +9,7 @@ */ public final class RecommendationsGenerateSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GenerateRecommendations.json + * x-ms-original-file: 2026-08-01-preview/GenerateRecommendations.json */ /** * Sample code: GenerateRecommendations. diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetByServiceGroupSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetByServiceGroupSamples.java new file mode 100644 index 0000000000000..2c408a870fe65 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetByServiceGroupSamples.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.advisor.generated; + +/** + * Samples for Recommendations GetByServiceGroup. + */ +public final class RecommendationsGetByServiceGroupSamples { + /* + * x-ms-original-file: 2026-08-01-preview/GetRecommendationDetailByServiceGroup.json + */ + /** + * Sample code: GetRecommendationDetailByServiceGroup. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getRecommendationDetailByServiceGroup(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .getByServiceGroupWithResponse("serviceGroupXYZ", "37c93209-4bfb-4f3b-8874-ccc718f7a467", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetGenerateStatusSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetGenerateStatusSamples.java index 2968c171d3cc8..b2b11a259ac25 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetGenerateStatusSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetGenerateStatusSamples.java @@ -1,18 +1,15 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; -import java.util.UUID; - /** * Samples for Recommendations GetGenerateStatus. */ public final class RecommendationsGetGenerateStatusSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/EmptyResponse.json + * x-ms-original-file: 2026-08-01-preview/EmptyResponse.json */ /** * Sample code: GetGenerateStatus. @@ -21,7 +18,6 @@ public final class RecommendationsGetGenerateStatusSamples { */ public static void getGenerateStatus(com.azure.resourcemanager.advisor.AdvisorManager manager) { manager.recommendations() - .getGenerateStatusWithResponse(UUID.fromString("00000000-0000-0000-0000-000000000000"), - com.azure.core.util.Context.NONE); + .getGenerateStatusWithResponse("123e4567-e89b-12d3-a456-426614174000", com.azure.core.util.Context.NONE); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetSamples.java index 93655c79e71e9..e5bed882666ad 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,15 +9,33 @@ */ public final class RecommendationsGetSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetRecommendationDetail.json + * x-ms-original-file: 2026-08-01-preview/GetRecommendationDetailServiceGroupResourceUri.json */ /** - * Sample code: GetRecommendationDetail. + * Sample code: GetRecommendationDetailServiceGroupResourceUri. * * @param manager Entry point to AdvisorManager. */ - public static void getRecommendationDetail(com.azure.resourcemanager.advisor.AdvisorManager manager) { - manager.recommendations().getWithResponse("resourceUri", "recommendationId", com.azure.core.util.Context.NONE); + public static void + getRecommendationDetailServiceGroupResourceUri(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .getWithResponse("providers/microsoft.management/serviceGroup/serviceGroupXYZ", + "37c93209-4bfb-4f3b-8874-ccc718f7a467", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-08-01-preview/GetRecommendationDetailSubscriptionResourceUri.json + */ + /** + * Sample code: GetRecommendationDetailSubscriptionResourceUri. + * + * @param manager Entry point to AdvisorManager. + */ + public static void + getRecommendationDetailSubscriptionResourceUri(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .getWithResponse( + "subscriptions/a5481ee1-95df-47d0-85d4-dd3f0dfa19bc/resourceGroups/resourceGroup/providers/Microsoft.Compute/availabilitysets/armavset", + "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45", com.azure.core.util.Context.NONE); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByServiceGroupSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByServiceGroupSamples.java new file mode 100644 index 0000000000000..a2902f3bf4103 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByServiceGroupSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.generated; + +import com.azure.resourcemanager.advisor.models.RecommendationListMode; + +/** + * Samples for Recommendations ListByServiceGroup. + */ +public final class RecommendationsListByServiceGroupSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListRecommendationsByServiceGroup.json + */ + /** + * Sample code: ListRecommendationsByServiceGroup. + * + * @param manager Entry point to AdvisorManager. + */ + public static void listRecommendationsByServiceGroup(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .listByServiceGroup("serviceGroupXYZ", null, RecommendationListMode.ALL, 10, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByTenantSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByTenantSamples.java new file mode 100644 index 0000000000000..c7d1c4782ec91 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByTenantSamples.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.advisor.generated; + +/** + * Samples for Recommendations ListByTenant. + */ +public final class RecommendationsListByTenantSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListRecommendationsServiceGroupResourceUri.json + */ + /** + * Sample code: ListRecommendationsServiceGroupResourceUri. + * + * @param manager Entry point to AdvisorManager. + */ + public static void + listRecommendationsServiceGroupResourceUri(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .listByTenant("providers/microsoft.management/serviceGroups/serviceGroupXYZ", null, 10, null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListSamples.java index 6770b6e4c0740..be185ed7e784e 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsListSamples.java @@ -1,23 +1,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; +import com.azure.resourcemanager.advisor.models.RecommendationListMode; + /** * Samples for Recommendations List. */ public final class RecommendationsListSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListRecommendations.json + * x-ms-original-file: 2026-08-01-preview/ListRecommendationsSubscriptionResourceUri.json */ /** - * Sample code: ListRecommendations. + * Sample code: ListRecommendationsSubscriptionResourceUri. * * @param manager Entry point to AdvisorManager. */ - public static void listRecommendations(com.azure.resourcemanager.advisor.AdvisorManager manager) { - manager.recommendations().list(null, 10, null, com.azure.core.util.Context.NONE); + public static void + listRecommendationsSubscriptionResourceUri(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations().list(null, RecommendationListMode.ALL, 10, null, com.azure.core.util.Context.NONE); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateByServiceGroupSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateByServiceGroupSamples.java new file mode 100644 index 0000000000000..a04857c60b800 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateByServiceGroupSamples.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.advisor.generated; + +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationPatchPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatePropertiesPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import java.time.OffsetDateTime; + +/** + * Samples for Recommendations UpdateByServiceGroup. + */ +public final class RecommendationsUpdateByServiceGroupSamples { + /* + * x-ms-original-file: 2026-08-01-preview/PatchRecommendationStatePropertiesByServiceGroup.json + */ + /** + * Sample code: PatchRecommendationStatePropertiesByServiceGroup. + * + * @param manager Entry point to AdvisorManager. + */ + public static void + patchRecommendationStatePropertiesByServiceGroup(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .updateByServiceGroupWithResponse("serviceGroupXYZ", + "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45", + new RecommendationPatchPayload().withProperties( + new RecommendationStatePropertiesPayload().withRecommendationStatus(RecommendationStatus.POSTPONED) + .withRecommendationDismissReason(RecommendationDismissReason.fromString("NotRelevant")) + .withPostponedUntilDateTime(OffsetDateTime.parse("2024-09-01T00:00:00Z"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateSamples.java new file mode 100644 index 0000000000000..81e16e2f6d221 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateSamples.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.advisor.generated; + +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationPatchPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatePropertiesPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import java.time.OffsetDateTime; + +/** + * Samples for Recommendations Update. + */ +public final class RecommendationsUpdateSamples { + /* + * x-ms-original-file: 2026-08-01-preview/PatchRecommendationStateProperties.json + */ + /** + * Sample code: PatchRecommendationStateProperties. + * + * @param manager Entry point to AdvisorManager. + */ + public static void patchRecommendationStateProperties(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.recommendations() + .updateWithResponse("2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45", + new RecommendationPatchPayload().withProperties( + new RecommendationStatePropertiesPayload().withRecommendationStatus(RecommendationStatus.POSTPONED) + .withRecommendationDismissReason(RecommendationDismissReason.fromString("NotRelevant")) + .withPostponedUntilDateTime(OffsetDateTime.parse("2024-09-01T00:00:00Z"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsGetSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsGetSamples.java new file mode 100644 index 0000000000000..e0672ff1d2a70 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsGetSamples.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.advisor.generated; + +/** + * Samples for ResiliencyReviews Get. + */ +public final class ResiliencyReviewsGetSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ResiliencyReviewsGet.json + */ + /** + * Sample code: GetResiliencyReview. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getResiliencyReview(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.resiliencyReviews() + .getWithResponse("11111111-1111-2222-3333-444444444444", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsListSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsListSamples.java new file mode 100644 index 0000000000000..1ea9f4b54a3f3 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsListSamples.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.advisor.generated; + +/** + * Samples for ResiliencyReviews List. + */ +public final class ResiliencyReviewsListSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ResiliencyReviewsList.json + */ + /** + * Sample code: ListResiliencyReviews. + * + * @param manager Entry point to AdvisorManager. + */ + public static void listResiliencyReviews(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.resiliencyReviews().list(null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResourceProviderPredictSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResourceProviderPredictSamples.java new file mode 100644 index 0000000000000..c20a5daa8a34c --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResourceProviderPredictSamples.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.PredictionRequest; +import com.azure.resourcemanager.advisor.models.PredictionType; +import java.nio.charset.StandardCharsets; + +/** + * Samples for ResourceProvider Predict. + */ +public final class ResourceProviderPredictSamples { + /* + * x-ms-original-file: 2026-08-01-preview/Predict.json + */ + /** + * Sample code: Predict. + * + * @param manager Entry point to AdvisorManager. + */ + public static void predict(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.resourceProviders() + .predictWithResponse(new PredictionRequest().withPredictionType(PredictionType.PREDICTIVE_RIGHTSIZING) + .withExtendedProperties(BinaryData.fromBytes( + "{region=CentralUS, deploymentType=Linux_IaaS_Software_Store, sku=Standard_Dv4, type=iaas, numberOfInstances=10}" + .getBytes(StandardCharsets.UTF_8))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsCreateSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsCreateSamples.java index c056648c3b921..79f25eabdd2df 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsCreateSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsCreateSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,8 +9,7 @@ */ public final class SuppressionsCreateSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/CreateSuppression.json + * x-ms-original-file: 2026-08-01-preview/CreateSuppression.json */ /** * Sample code: CreateSuppression. @@ -19,8 +18,9 @@ public final class SuppressionsCreateSamples { */ public static void createSuppression(com.azure.resourcemanager.advisor.AdvisorManager manager) { manager.suppressions() - .define("suppressionName1") - .withExistingRecommendation("resourceUri", "recommendationId") + .define("2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45") + .withExistingRecommendation("resourceUri", + "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b36") .withTtl("07:00:00:00") .create(); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsDeleteSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsDeleteSamples.java index 027f1949ad492..84eb584bc4ba6 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsDeleteSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsDeleteSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,8 +9,7 @@ */ public final class SuppressionsDeleteSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/DeleteSuppression.json + * x-ms-original-file: 2026-08-01-preview/DeleteSuppression.json */ /** * Sample code: DeleteSuppression. @@ -19,7 +18,7 @@ public final class SuppressionsDeleteSamples { */ public static void deleteSuppression(com.azure.resourcemanager.advisor.AdvisorManager manager) { manager.suppressions() - .deleteWithResponse("resourceUri", "recommendationId", "suppressionName1", + .deleteWithResponse("resourceUri", "recommendationId", "HardcodedSuppressionName", com.azure.core.util.Context.NONE); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsGetSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsGetSamples.java index 84838a00c7497..80dbeeaca376b 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsGetSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsGetSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,8 +9,7 @@ */ public final class SuppressionsGetSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetSuppressionDetail.json + * x-ms-original-file: 2026-08-01-preview/GetSuppressionDetail.json */ /** * Sample code: GetSuppressionDetail. @@ -19,6 +18,7 @@ public final class SuppressionsGetSamples { */ public static void getSuppressionDetail(com.azure.resourcemanager.advisor.AdvisorManager manager) { manager.suppressions() - .getWithResponse("resourceUri", "recommendationId", "suppressionName1", com.azure.core.util.Context.NONE); + .getWithResponse("resourceUri", "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b45", + "2e7c72b2d7987ec224a1ebae03398b0fbdaa9a5a6a762e6fcf1c806599744b87", com.azure.core.util.Context.NONE); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsListSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsListSamples.java index 3c16494408414..0791422365bf9 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsListSamples.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/SuppressionsListSamples.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -9,8 +9,7 @@ */ public final class SuppressionsListSamples { /* - * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListSuppressions.json + * x-ms-original-file: 2026-08-01-preview/ListSuppressions.json */ /** * Sample code: ListSuppressions. diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/WorkloadsListSamples.java b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/WorkloadsListSamples.java new file mode 100644 index 0000000000000..3322baadd0276 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/WorkloadsListSamples.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.advisor.generated; + +/** + * Samples for Workloads List. + */ +public final class WorkloadsListSamples { + /* + * x-ms-original-file: 2026-08-01-preview/ListWorkloads.json + */ + /** + * Sample code: GetWorkloads. + * + * @param manager Entry point to AdvisorManager. + */ + public static void getWorkloads(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.workloads().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreEntityInnerTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreEntityInnerTests.java new file mode 100644 index 0000000000000..aebd789d16bd2 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreEntityInnerTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner; +import com.azure.resourcemanager.advisor.models.Aggregated; +import org.junit.jupiter.api.Assertions; + +public final class AdvisorScoreEntityInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AdvisorScoreEntityInner model = BinaryData.fromString( + "{\"properties\":{\"lastRefreshedScore\":{\"date\":\"znfqqnvwpmqtar\",\"score\":61.12801528748727,\"consumptionUnits\":90.90835344816338,\"impactedResourceCount\":33.223091053692336,\"potentialScoreIncrease\":83.08001426115167,\"categoryCount\":1.7570781274461988},\"timeSeries\":[{\"aggregationLevel\":\"week\",\"scoreHistory\":[{\"date\":\"drjervnaenqpehin\",\"score\":20.85641107316347,\"consumptionUnits\":36.17542293520456,\"impactedResourceCount\":83.72474102176439,\"potentialScoreIncrease\":3.07804342139979,\"categoryCount\":6.862376696344629},{\"date\":\"nayqi\",\"score\":83.24161108939569,\"consumptionUnits\":97.67634640408605,\"impactedResourceCount\":66.08419013087935,\"potentialScoreIncrease\":94.81316701776056,\"categoryCount\":21.383016944125554},{\"date\":\"qolbgyc\",\"score\":82.72597128581467,\"consumptionUnits\":75.81883341493736,\"impactedResourceCount\":14.577977421372069,\"potentialScoreIncrease\":63.86816695634684,\"categoryCount\":0.14011937036747524},{\"date\":\"slqlfmmdn\",\"score\":62.38921813874055,\"consumptionUnits\":67.10998685972321,\"impactedResourceCount\":70.2753168369226,\"potentialScoreIncrease\":76.70320207909522,\"categoryCount\":13.743598255403267}]}]},\"id\":\"dxssadbzm\",\"name\":\"vdfznudaodvxzb\",\"type\":\"cblylpstdbhhxsr\"}") + .toObject(AdvisorScoreEntityInner.class); + Assertions.assertEquals("znfqqnvwpmqtar", model.lastRefreshedScore().date()); + Assertions.assertEquals(61.12801528748727D, model.lastRefreshedScore().score()); + Assertions.assertEquals(90.90835344816338D, model.lastRefreshedScore().consumptionUnits()); + Assertions.assertEquals(33.223091053692336D, model.lastRefreshedScore().impactedResourceCount()); + Assertions.assertEquals(83.08001426115167D, model.lastRefreshedScore().potentialScoreIncrease()); + Assertions.assertEquals(Aggregated.WEEK, model.timeSeries().get(0).aggregationLevel()); + Assertions.assertEquals("drjervnaenqpehin", model.timeSeries().get(0).scoreHistory().get(0).date()); + Assertions.assertEquals(20.85641107316347D, model.timeSeries().get(0).scoreHistory().get(0).score()); + Assertions.assertEquals(36.17542293520456D, model.timeSeries().get(0).scoreHistory().get(0).consumptionUnits()); + Assertions.assertEquals(83.72474102176439D, + model.timeSeries().get(0).scoreHistory().get(0).impactedResourceCount()); + Assertions.assertEquals(3.07804342139979D, + model.timeSeries().get(0).scoreHistory().get(0).potentialScoreIncrease()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreEntityPropertiesTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreEntityPropertiesTests.java new file mode 100644 index 0000000000000..6fe4c75cbfcab --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreEntityPropertiesTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityProperties; +import com.azure.resourcemanager.advisor.models.Aggregated; +import org.junit.jupiter.api.Assertions; + +public final class AdvisorScoreEntityPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AdvisorScoreEntityProperties model = BinaryData.fromString( + "{\"lastRefreshedScore\":{\"date\":\"ucerscdntnevfi\",\"score\":56.13333824147031,\"consumptionUnits\":20.222528894450797,\"impactedResourceCount\":33.72214282322261,\"potentialScoreIncrease\":45.243571279138685,\"categoryCount\":77.25484909336522},\"timeSeries\":[{\"aggregationLevel\":\"day\",\"scoreHistory\":[{\"date\":\"qsemwabne\",\"score\":28.75961030665882,\"consumptionUnits\":61.18059016219143,\"impactedResourceCount\":0.4723501671687447,\"potentialScoreIncrease\":85.43814171417826,\"categoryCount\":69.82138100539913}]}]}") + .toObject(AdvisorScoreEntityProperties.class); + Assertions.assertEquals("ucerscdntnevfi", model.lastRefreshedScore().date()); + Assertions.assertEquals(56.13333824147031D, model.lastRefreshedScore().score()); + Assertions.assertEquals(20.222528894450797D, model.lastRefreshedScore().consumptionUnits()); + Assertions.assertEquals(33.72214282322261D, model.lastRefreshedScore().impactedResourceCount()); + Assertions.assertEquals(45.243571279138685D, model.lastRefreshedScore().potentialScoreIncrease()); + Assertions.assertEquals(Aggregated.DAY, model.timeSeries().get(0).aggregationLevel()); + Assertions.assertEquals("qsemwabne", model.timeSeries().get(0).scoreHistory().get(0).date()); + Assertions.assertEquals(28.75961030665882D, model.timeSeries().get(0).scoreHistory().get(0).score()); + Assertions.assertEquals(61.18059016219143D, model.timeSeries().get(0).scoreHistory().get(0).consumptionUnits()); + Assertions.assertEquals(0.4723501671687447D, + model.timeSeries().get(0).scoreHistory().get(0).impactedResourceCount()); + Assertions.assertEquals(85.43814171417826D, + model.timeSeries().get(0).scoreHistory().get(0).potentialScoreIncrease()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreResponseTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreResponseTests.java new file mode 100644 index 0000000000000..528b40e15592b --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoreResponseTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.implementation.models.AdvisorScoreResponse; +import com.azure.resourcemanager.advisor.models.Aggregated; +import org.junit.jupiter.api.Assertions; + +public final class AdvisorScoreResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AdvisorScoreResponse model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"lastRefreshedScore\":{\"date\":\"hhvh\",\"score\":1.5751802276445237,\"consumptionUnits\":54.44956675221493,\"impactedResourceCount\":79.10635369801082,\"potentialScoreIncrease\":29.50996555933806,\"categoryCount\":71.73574705933942},\"timeSeries\":[{\"aggregationLevel\":\"month\",\"scoreHistory\":[{}]},{\"aggregationLevel\":\"week\",\"scoreHistory\":[{},{},{},{}]}]},\"id\":\"gqxndlkzgxhuripl\",\"name\":\"podxunkb\",\"type\":\"bxmubyynt\"},{\"properties\":{\"lastRefreshedScore\":{\"date\":\"qtkoievs\",\"score\":21.45306714793218,\"consumptionUnits\":92.22079373726689,\"impactedResourceCount\":59.484183441444884,\"potentialScoreIncrease\":76.4560281327405,\"categoryCount\":17.204226472435515},\"timeSeries\":[{\"aggregationLevel\":\"week\",\"scoreHistory\":[{},{},{},{}]},{\"aggregationLevel\":\"day\",\"scoreHistory\":[{},{},{},{}]},{\"aggregationLevel\":\"day\",\"scoreHistory\":[{},{},{},{}]}]},\"id\":\"uvpb\",\"name\":\"tdum\",\"type\":\"rp\"},{\"properties\":{\"lastRefreshedScore\":{\"date\":\"mnzb\",\"score\":39.987620282609846,\"consumptionUnits\":25.369948465939373,\"impactedResourceCount\":83.96811906012715,\"potentialScoreIncrease\":56.564678611315244,\"categoryCount\":19.419013223108507},\"timeSeries\":[{\"aggregationLevel\":\"week\",\"scoreHistory\":[{},{},{},{}]},{\"aggregationLevel\":\"week\",\"scoreHistory\":[{}]},{\"aggregationLevel\":\"day\",\"scoreHistory\":[{},{},{}]},{\"aggregationLevel\":\"day\",\"scoreHistory\":[{},{},{},{}]}]},\"id\":\"quuvxzxcl\",\"name\":\"ithhqzon\",\"type\":\"sg\"},{\"properties\":{\"lastRefreshedScore\":{\"date\":\"ohfwds\",\"score\":10.708622124516086,\"consumptionUnits\":66.62335328768224,\"impactedResourceCount\":84.84821657546152,\"potentialScoreIncrease\":21.926404455021643,\"categoryCount\":37.01990613348896},\"timeSeries\":[{\"aggregationLevel\":\"month\",\"scoreHistory\":[{},{},{}]},{\"aggregationLevel\":\"month\",\"scoreHistory\":[{},{}]},{\"aggregationLevel\":\"day\",\"scoreHistory\":[{},{},{}]},{\"aggregationLevel\":\"month\",\"scoreHistory\":[{},{}]}]},\"id\":\"n\",\"name\":\"pfuflrw\",\"type\":\"mh\"}]}") + .toObject(AdvisorScoreResponse.class); + Assertions.assertEquals("hhvh", model.value().get(0).lastRefreshedScore().date()); + Assertions.assertEquals(1.5751802276445237D, model.value().get(0).lastRefreshedScore().score()); + Assertions.assertEquals(54.44956675221493D, model.value().get(0).lastRefreshedScore().consumptionUnits()); + Assertions.assertEquals(79.10635369801082D, model.value().get(0).lastRefreshedScore().impactedResourceCount()); + Assertions.assertEquals(29.50996555933806D, model.value().get(0).lastRefreshedScore().potentialScoreIncrease()); + Assertions.assertEquals(Aggregated.MONTH, model.value().get(0).timeSeries().get(0).aggregationLevel()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresGetWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresGetWithResponseMockTests.java new file mode 100644 index 0000000000000..974d78e78e492 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresGetWithResponseMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.AdvisorScoreEntity; +import com.azure.resourcemanager.advisor.models.Aggregated; +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 AdvisorScoresGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"lastRefreshedScore\":{\"date\":\"gbeglqgleo\",\"score\":90.18495786975518,\"consumptionUnits\":17.572008411269323,\"impactedResourceCount\":54.62231525093968,\"potentialScoreIncrease\":20.234642322395146,\"categoryCount\":94.08640661757805},\"timeSeries\":[{\"aggregationLevel\":\"week\",\"scoreHistory\":[{}]},{\"aggregationLevel\":\"week\",\"scoreHistory\":[{},{}]},{\"aggregationLevel\":\"month\",\"scoreHistory\":[{}]},{\"aggregationLevel\":\"day\",\"scoreHistory\":[{}]}]},\"id\":\"aj\",\"name\":\"nw\",\"type\":\"acevehjkuyx\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + AdvisorScoreEntity response + = manager.advisorScores().getWithResponse("yhyhsgzfczb", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("gbeglqgleo", response.lastRefreshedScore().date()); + Assertions.assertEquals(90.18495786975518D, response.lastRefreshedScore().score()); + Assertions.assertEquals(17.572008411269323D, response.lastRefreshedScore().consumptionUnits()); + Assertions.assertEquals(54.62231525093968D, response.lastRefreshedScore().impactedResourceCount()); + Assertions.assertEquals(20.234642322395146D, response.lastRefreshedScore().potentialScoreIncrease()); + Assertions.assertEquals(Aggregated.WEEK, response.timeSeries().get(0).aggregationLevel()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresListMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresListMockTests.java new file mode 100644 index 0000000000000..7b7b58874185d --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresListMockTests.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.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.AdvisorScoreEntity; +import com.azure.resourcemanager.advisor.models.Aggregated; +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 AdvisorScoresListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"lastRefreshedScore\":{\"date\":\"aoqltfaey\",\"score\":6.453199531068621,\"consumptionUnits\":9.687631881455605,\"impactedResourceCount\":86.09789611813021,\"potentialScoreIncrease\":11.588340754514393,\"categoryCount\":99.47981713644863},\"timeSeries\":[{\"aggregationLevel\":\"week\",\"scoreHistory\":[{},{},{}]},{\"aggregationLevel\":\"week\",\"scoreHistory\":[{},{},{}]},{\"aggregationLevel\":\"month\",\"scoreHistory\":[{},{},{},{}]},{\"aggregationLevel\":\"week\",\"scoreHistory\":[{},{},{},{}]}]},\"id\":\"ciqdsme\",\"name\":\"iitdfuxt\",\"type\":\"asiibmiybnnust\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.advisorScores().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("aoqltfaey", response.iterator().next().lastRefreshedScore().date()); + Assertions.assertEquals(6.453199531068621D, response.iterator().next().lastRefreshedScore().score()); + Assertions.assertEquals(9.687631881455605D, response.iterator().next().lastRefreshedScore().consumptionUnits()); + Assertions.assertEquals(86.09789611813021D, + response.iterator().next().lastRefreshedScore().impactedResourceCount()); + Assertions.assertEquals(11.588340754514393D, + response.iterator().next().lastRefreshedScore().potentialScoreIncrease()); + Assertions.assertEquals(Aggregated.WEEK, response.iterator().next().timeSeries().get(0).aggregationLevel()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentListResultTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentListResultTests.java new file mode 100644 index 0000000000000..476476390bce7 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentListResultTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.implementation.models.AssessmentListResult; +import org.junit.jupiter.api.Assertions; + +public final class AssessmentListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AssessmentListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"workloadId\":\"dqrhzoymib\",\"workloadName\":\"qyib\",\"assessmentId\":\"wfluszdt\",\"description\":\"rkwofyyvoqa\",\"typeId\":\"iexpbtgiwbwo\",\"type\":\"washr\",\"score\":2130378751,\"state\":\"cnqxwbpokulpi\",\"typeVersion\":\"waasip\",\"locale\":\"iobyu\"},\"id\":\"rpqlp\",\"name\":\"wcciuqgbdbu\",\"type\":\"auvfbtkuwhhmhyk\"},{\"properties\":{\"workloadId\":\"xafnndlpichko\",\"workloadName\":\"kcdyhbpk\",\"assessmentId\":\"wdreqnovvqfovl\",\"description\":\"ywsuwsy\",\"typeId\":\"ndsytgadg\",\"type\":\"aeaeneqnzarrw\",\"score\":333965716,\"state\":\"ijfqkacewiipfp\",\"typeVersion\":\"ji\",\"locale\":\"wifto\"},\"id\":\"kvpuvksgplsaknyn\",\"name\":\"synljphuopxodl\",\"type\":\"iyntorzihle\"},{\"properties\":{\"workloadId\":\"swsrms\",\"workloadName\":\"zrpzb\",\"assessmentId\":\"ckqqzqioxiysui\",\"description\":\"ynkedyatrwyhqmib\",\"typeId\":\"hwit\",\"type\":\"ypyynpcdpumnzg\",\"score\":83591449,\"state\":\"mabiknsorgjhxb\",\"typeVersion\":\"tlwwrlk\",\"locale\":\"tncvokot\"},\"id\":\"xdy\",\"name\":\"gsyocogj\",\"type\":\"tdtbnnhadooc\"},{\"properties\":{\"workloadId\":\"cikhnv\",\"workloadName\":\"mqg\",\"assessmentId\":\"queziky\",\"description\":\"gxk\",\"typeId\":\"la\",\"type\":\"elwuipi\",\"score\":1198418421,\"state\":\"kzivgvvcnayrh\",\"typeVersion\":\"nxxmueedndrdv\",\"locale\":\"kwqqtchealmf\"},\"id\":\"d\",\"name\":\"aygdvwvgpioh\",\"type\":\"wxrt\"}],\"nextLink\":\"dxepxgyq\"}") + .toObject(AssessmentListResult.class); + Assertions.assertEquals("dqrhzoymib", model.value().get(0).workloadId()); + Assertions.assertEquals("iexpbtgiwbwo", model.value().get(0).typeId()); + Assertions.assertEquals("iobyu", model.value().get(0).locale()); + Assertions.assertEquals("dxepxgyq", model.nextLink()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentResultInnerTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentResultInnerTests.java new file mode 100644 index 0000000000000..40585d4c4ebcd --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentResultInnerTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.AssessmentResultInner; +import org.junit.jupiter.api.Assertions; + +public final class AssessmentResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AssessmentResultInner model = BinaryData.fromString( + "{\"properties\":{\"workloadId\":\"yjrxsagafcnih\",\"workloadName\":\"qapnedgfbcv\",\"assessmentId\":\"vq\",\"description\":\"keqdcvdrhvoods\",\"typeId\":\"bobzdopcjwvnhd\",\"type\":\"wmgxcxrsl\",\"score\":1073132708,\"state\":\"wuoegrpk\",\"typeVersion\":\"wniyqsluicpd\",\"locale\":\"kzzlvmbmpaxmodf\"},\"id\":\"efyw\",\"name\":\"bpfvm\",\"type\":\"yhrfouyftaakcpw\"}") + .toObject(AssessmentResultInner.class); + Assertions.assertEquals("yjrxsagafcnih", model.workloadId()); + Assertions.assertEquals("bobzdopcjwvnhd", model.typeId()); + Assertions.assertEquals("kzzlvmbmpaxmodf", model.locale()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AssessmentResultInner model = new AssessmentResultInner().withWorkloadId("yjrxsagafcnih") + .withTypeId("bobzdopcjwvnhd") + .withLocale("kzzlvmbmpaxmodf"); + model = BinaryData.fromObject(model).toObject(AssessmentResultInner.class); + Assertions.assertEquals("yjrxsagafcnih", model.workloadId()); + Assertions.assertEquals("bobzdopcjwvnhd", model.typeId()); + Assertions.assertEquals("kzzlvmbmpaxmodf", model.locale()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentResultPropertiesTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentResultPropertiesTests.java new file mode 100644 index 0000000000000..b7649820f57ae --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentResultPropertiesTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.AssessmentResultProperties; +import org.junit.jupiter.api.Assertions; + +public final class AssessmentResultPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AssessmentResultProperties model = BinaryData.fromString( + "{\"workloadId\":\"zvqtmnubexkp\",\"workloadName\":\"smond\",\"assessmentId\":\"quxvypomgkop\",\"description\":\"hojvpajqgxysmocm\",\"typeId\":\"fqvm\",\"type\":\"xozap\",\"score\":1382848835,\"state\":\"xprglyatddc\",\"typeVersion\":\"bcuejrjxgci\",\"locale\":\"brh\"}") + .toObject(AssessmentResultProperties.class); + Assertions.assertEquals("zvqtmnubexkp", model.workloadId()); + Assertions.assertEquals("fqvm", model.typeId()); + Assertions.assertEquals("brh", model.locale()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AssessmentResultProperties model + = new AssessmentResultProperties().withWorkloadId("zvqtmnubexkp").withTypeId("fqvm").withLocale("brh"); + model = BinaryData.fromObject(model).toObject(AssessmentResultProperties.class); + Assertions.assertEquals("zvqtmnubexkp", model.workloadId()); + Assertions.assertEquals("fqvm", model.typeId()); + Assertions.assertEquals("brh", model.locale()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypeListResultTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypeListResultTests.java new file mode 100644 index 0000000000000..508bb49159ecd --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypeListResultTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.implementation.models.AssessmentTypeListResult; +import org.junit.jupiter.api.Assertions; + +public final class AssessmentTypeListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AssessmentTypeListResult model = BinaryData.fromString( + "{\"value\":[{\"id\":\"uzkopbminrfd\",\"title\":\"yuhhziu\",\"description\":\"fozbhdmsmlmzqhof\",\"locale\":\"maequiahxicslfa\",\"version\":\"z\"},{\"id\":\"yylhalnswhccsp\",\"title\":\"aivwitqscywu\",\"description\":\"woluhczbwemhair\",\"locale\":\"rgzdwmsweyp\",\"version\":\"dxggicccnxqhuexm\"},{\"id\":\"tlstvlzywem\",\"title\":\"rncsdtclu\",\"description\":\"ypbsfgytguslfead\",\"locale\":\"gq\",\"version\":\"yhejhzisxgfp\"}],\"nextLink\":\"olppvksrpqvujz\"}") + .toObject(AssessmentTypeListResult.class); + Assertions.assertEquals("uzkopbminrfd", model.value().get(0).id()); + Assertions.assertEquals("yuhhziu", model.value().get(0).title()); + Assertions.assertEquals("fozbhdmsmlmzqhof", model.value().get(0).description()); + Assertions.assertEquals("maequiahxicslfa", model.value().get(0).locale()); + Assertions.assertEquals("z", model.value().get(0).version()); + Assertions.assertEquals("olppvksrpqvujz", model.nextLink()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypeResultInnerTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypeResultInnerTests.java new file mode 100644 index 0000000000000..7d3e0fdcdea8b --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypeResultInnerTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.AssessmentTypeResultInner; +import org.junit.jupiter.api.Assertions; + +public final class AssessmentTypeResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AssessmentTypeResultInner model = BinaryData.fromString( + "{\"id\":\"ehtwdwrft\",\"title\":\"iby\",\"description\":\"dl\",\"locale\":\"shfwpracstwity\",\"version\":\"evxccedcp\"}") + .toObject(AssessmentTypeResultInner.class); + Assertions.assertEquals("ehtwdwrft", model.id()); + Assertions.assertEquals("iby", model.title()); + Assertions.assertEquals("dl", model.description()); + Assertions.assertEquals("shfwpracstwity", model.locale()); + Assertions.assertEquals("evxccedcp", model.version()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypesListMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypesListMockTests.java new file mode 100644 index 0000000000000..a423c5ddb3c87 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentTypesListMockTests.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.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.AssessmentTypeResult; +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 AssessmentTypesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"id\":\"g\",\"title\":\"npbs\",\"description\":\"e\",\"locale\":\"occsr\",\"version\":\"zihmipgawtxxpky\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.assessmentTypes().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("g", response.iterator().next().id()); + Assertions.assertEquals("npbs", response.iterator().next().title()); + Assertions.assertEquals("e", response.iterator().next().description()); + Assertions.assertEquals("occsr", response.iterator().next().locale()); + Assertions.assertEquals("zihmipgawtxxpky", response.iterator().next().version()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsDeleteWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsDeleteWithResponseMockTests.java new file mode 100644 index 0000000000000..5daa122c86194 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsDeleteWithResponseMockTests.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.advisor.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.advisor.AdvisorManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class AssessmentsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.assessments().deleteWithResponse("bdb", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsGetWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsGetWithResponseMockTests.java new file mode 100644 index 0000000000000..d126d060b4717 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsGetWithResponseMockTests.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.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.AssessmentResult; +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 AssessmentsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"workloadId\":\"g\",\"workloadName\":\"hcmavmqfo\",\"assessmentId\":\"or\",\"description\":\"gyyprotwy\",\"typeId\":\"ndm\",\"type\":\"hu\",\"score\":1120408256,\"state\":\"k\",\"typeVersion\":\"lgorb\",\"locale\":\"tp\"},\"id\":\"tzfjltf\",\"name\":\"nzcyjtotp\",\"type\":\"opv\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + AssessmentResult response + = manager.assessments().getWithResponse("nlj", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("g", response.workloadId()); + Assertions.assertEquals("ndm", response.typeId()); + Assertions.assertEquals("tp", response.locale()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsListMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsListMockTests.java new file mode 100644 index 0000000000000..689d6a9f4867f --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsListMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.AssessmentResult; +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 AssessmentsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"workloadId\":\"ohsdtmcd\",\"workloadName\":\"ufcohdxbz\",\"assessmentId\":\"cmuapcvhd\",\"description\":\"v\",\"typeId\":\"qxeysko\",\"type\":\"zinkfkbgbzbowxeq\",\"score\":1971838421,\"state\":\"mygvkzqkj\",\"typeVersion\":\"okbzef\",\"locale\":\"rx\"},\"id\":\"zurtleipqxbkwvz\",\"name\":\"nzvdfbzdixzmq\",\"type\":\"noda\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.assessments().list("qgqqihedsvqwthmk", "ibcysihsgqc", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("ohsdtmcd", response.iterator().next().workloadId()); + Assertions.assertEquals("qxeysko", response.iterator().next().typeId()); + Assertions.assertEquals("rx", response.iterator().next().locale()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsPutWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsPutWithResponseMockTests.java new file mode 100644 index 0000000000000..7b4bf3d8eb291 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/AssessmentsPutWithResponseMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.AssessmentResult; +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 AssessmentsPutWithResponseMockTests { + @Test + public void testPutWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"workloadId\":\"clj\",\"workloadName\":\"yexaoguy\",\"assessmentId\":\"p\",\"description\":\"sdaultxij\",\"typeId\":\"mfqwa\",\"type\":\"nqnm\",\"score\":714307587,\"state\":\"zqdqxt\",\"typeVersion\":\"wgnyfusfzsvtui\",\"locale\":\"hajqglcfh\"},\"id\":\"rqryxynqn\",\"name\":\"rd\",\"type\":\"sovwxznptgoeiyb\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + AssessmentResult response = manager.assessments() + .define("opqhewjptmc") + .withWorkloadId("ostzelndlatu") + .withTypeId("lbkpb") + .withLocale("fqsfa") + .create(); + + Assertions.assertEquals("clj", response.workloadId()); + Assertions.assertEquals("mfqwa", response.typeId()); + Assertions.assertEquals("hajqglcfh", response.locale()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigDataInnerTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigDataInnerTests.java index d42475b30d682..f34d1027f353c 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigDataInnerTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigDataInnerTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -10,6 +10,7 @@ import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfig; import com.azure.resourcemanager.advisor.models.DigestConfigState; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.util.Arrays; import org.junit.jupiter.api.Assertions; @@ -17,36 +18,54 @@ public final class ConfigDataInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ConfigDataInner model = BinaryData.fromString( - "{\"properties\":{\"exclude\":true,\"lowCpuThreshold\":\"15\",\"digests\":[{\"name\":\"suuv\",\"actionGroupResourceId\":\"jozkrwfndiod\",\"frequency\":230645799,\"categories\":[\"Security\"],\"language\":\"dpvwryoqpsoaccta\",\"state\":\"Active\"}]},\"id\":\"ljlahbcryf\",\"name\":\"dfdosygexp\",\"type\":\"ojakhmsbzjhcrze\"}") + "{\"properties\":{\"exclude\":false,\"lowCpuThreshold\":\"10\",\"duration\":\"90\",\"digests\":[{\"name\":\"dflvkg\",\"actionGroupResourceId\":\"bgdknnqv\",\"frequency\":1989846717,\"categories\":[\"Security\",\"Cost\",\"OperationalExcellence\",\"OperationalExcellence\"],\"language\":\"dsg\",\"state\":\"Active\"},{\"name\":\"kycgrauwj\",\"actionGroupResourceId\":\"taeburuvdm\",\"frequency\":136999503,\"categories\":[\"Security\",\"Security\",\"HighAvailability\",\"Security\"],\"language\":\"mqoefkifrvtpuqu\",\"state\":\"Active\"},{\"name\":\"gkfbtndoaong\",\"actionGroupResourceId\":\"cn\",\"frequency\":1376846032,\"categories\":[\"HighAvailability\"],\"language\":\"ed\",\"state\":\"Active\"}]},\"id\":\"ae\",\"name\":\"kojvd\",\"type\":\"pzfoqoui\"}") .toObject(ConfigDataInner.class); - Assertions.assertEquals(true, model.exclude()); - Assertions.assertEquals(CpuThreshold.ONE_FIVE, model.lowCpuThreshold()); - Assertions.assertEquals("suuv", model.digests().get(0).name()); - Assertions.assertEquals("jozkrwfndiod", model.digests().get(0).actionGroupResourceId()); - Assertions.assertEquals(230645799, model.digests().get(0).frequency()); + Assertions.assertFalse(model.exclude()); + Assertions.assertEquals(CpuThreshold.ONE_ZERO, model.lowCpuThreshold()); + Assertions.assertEquals(DurationModel.NINE_ZERO, model.duration()); + Assertions.assertEquals("dflvkg", model.digests().get(0).name()); + Assertions.assertEquals("bgdknnqv", model.digests().get(0).actionGroupResourceId()); + Assertions.assertEquals(1989846717, model.digests().get(0).frequency()); Assertions.assertEquals(Category.SECURITY, model.digests().get(0).categories().get(0)); - Assertions.assertEquals("dpvwryoqpsoaccta", model.digests().get(0).language()); + Assertions.assertEquals("dsg", model.digests().get(0).language()); Assertions.assertEquals(DigestConfigState.ACTIVE, model.digests().get(0).state()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ConfigDataInner model = new ConfigDataInner().withExclude(true) - .withLowCpuThreshold(CpuThreshold.ONE_FIVE) - .withDigests(Arrays.asList(new DigestConfig().withName("suuv") - .withActionGroupResourceId("jozkrwfndiod") - .withFrequency(230645799) - .withCategories(Arrays.asList(Category.SECURITY)) - .withLanguage("dpvwryoqpsoaccta") - .withState(DigestConfigState.ACTIVE))); + ConfigDataInner model = new ConfigDataInner().withExclude(false) + .withLowCpuThreshold(CpuThreshold.ONE_ZERO) + .withDuration(DurationModel.NINE_ZERO) + .withDigests(Arrays.asList( + new DigestConfig().withName("dflvkg") + .withActionGroupResourceId("bgdknnqv") + .withFrequency(1989846717) + .withCategories(Arrays.asList(Category.SECURITY, Category.COST, Category.OPERATIONAL_EXCELLENCE, + Category.OPERATIONAL_EXCELLENCE)) + .withLanguage("dsg") + .withState(DigestConfigState.ACTIVE), + new DigestConfig().withName("kycgrauwj") + .withActionGroupResourceId("taeburuvdm") + .withFrequency(136999503) + .withCategories(Arrays.asList(Category.SECURITY, Category.SECURITY, Category.HIGH_AVAILABILITY, + Category.SECURITY)) + .withLanguage("mqoefkifrvtpuqu") + .withState(DigestConfigState.ACTIVE), + new DigestConfig().withName("gkfbtndoaong") + .withActionGroupResourceId("cn") + .withFrequency(1376846032) + .withCategories(Arrays.asList(Category.HIGH_AVAILABILITY)) + .withLanguage("ed") + .withState(DigestConfigState.ACTIVE))); model = BinaryData.fromObject(model).toObject(ConfigDataInner.class); - Assertions.assertEquals(true, model.exclude()); - Assertions.assertEquals(CpuThreshold.ONE_FIVE, model.lowCpuThreshold()); - Assertions.assertEquals("suuv", model.digests().get(0).name()); - Assertions.assertEquals("jozkrwfndiod", model.digests().get(0).actionGroupResourceId()); - Assertions.assertEquals(230645799, model.digests().get(0).frequency()); + Assertions.assertFalse(model.exclude()); + Assertions.assertEquals(CpuThreshold.ONE_ZERO, model.lowCpuThreshold()); + Assertions.assertEquals(DurationModel.NINE_ZERO, model.duration()); + Assertions.assertEquals("dflvkg", model.digests().get(0).name()); + Assertions.assertEquals("bgdknnqv", model.digests().get(0).actionGroupResourceId()); + Assertions.assertEquals(1989846717, model.digests().get(0).frequency()); Assertions.assertEquals(Category.SECURITY, model.digests().get(0).categories().get(0)); - Assertions.assertEquals("dpvwryoqpsoaccta", model.digests().get(0).language()); + Assertions.assertEquals("dsg", model.digests().get(0).language()); Assertions.assertEquals(DigestConfigState.ACTIVE, model.digests().get(0).state()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigDataPropertiesTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigDataPropertiesTests.java index 72e45211342ef..437fe5cd6e176 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigDataPropertiesTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigDataPropertiesTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -10,6 +10,7 @@ import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfig; import com.azure.resourcemanager.advisor.models.DigestConfigState; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.util.Arrays; import org.junit.jupiter.api.Assertions; @@ -17,51 +18,60 @@ public final class ConfigDataPropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ConfigDataProperties model = BinaryData.fromString( - "{\"exclude\":false,\"lowCpuThreshold\":\"20\",\"digests\":[{\"name\":\"lthqtrgqjbp\",\"actionGroupResourceId\":\"fsinzgvfcjrwzoxx\",\"frequency\":1440397986,\"categories\":[\"Performance\",\"OperationalExcellence\",\"HighAvailability\",\"Performance\"],\"language\":\"it\",\"state\":\"Disabled\"},{\"name\":\"qfpjk\",\"actionGroupResourceId\":\"xofpdvhpfxxypi\",\"frequency\":7569944,\"categories\":[\"Cost\",\"Security\"],\"language\":\"ybb\",\"state\":\"Disabled\"},{\"name\":\"epoo\",\"actionGroupResourceId\":\"nuvamiheogna\",\"frequency\":1893731030,\"categories\":[\"HighAvailability\",\"HighAvailability\",\"Security\"],\"language\":\"usivye\",\"state\":\"Disabled\"}]}") + "{\"exclude\":true,\"lowCpuThreshold\":\"5\",\"duration\":\"14\",\"digests\":[{\"name\":\"ufoxc\",\"actionGroupResourceId\":\"opidoamciodh\",\"frequency\":1741139859,\"categories\":[\"OperationalExcellence\",\"Security\",\"Security\",\"Performance\"],\"language\":\"onlwntoeg\",\"state\":\"Disabled\"},{\"name\":\"bwh\",\"actionGroupResourceId\":\"z\",\"frequency\":793958832,\"categories\":[\"Cost\",\"HighAvailability\",\"HighAvailability\"],\"language\":\"vbtqgsfraoyzk\",\"state\":\"Active\"},{\"name\":\"lmnguxaw\",\"actionGroupResourceId\":\"ldsyuuximerqfob\",\"frequency\":2077702872,\"categories\":[\"Security\"],\"language\":\"kutwpf\",\"state\":\"Active\"},{\"name\":\"m\",\"actionGroupResourceId\":\"skdsnfdsdoakg\",\"frequency\":978154118,\"categories\":[\"Security\"],\"language\":\"evdlh\",\"state\":\"Active\"}]}") .toObject(ConfigDataProperties.class); - Assertions.assertEquals(false, model.exclude()); - Assertions.assertEquals(CpuThreshold.TWO_ZERO, model.lowCpuThreshold()); - Assertions.assertEquals("lthqtrgqjbp", model.digests().get(0).name()); - Assertions.assertEquals("fsinzgvfcjrwzoxx", model.digests().get(0).actionGroupResourceId()); - Assertions.assertEquals(1440397986, model.digests().get(0).frequency()); - Assertions.assertEquals(Category.PERFORMANCE, model.digests().get(0).categories().get(0)); - Assertions.assertEquals("it", model.digests().get(0).language()); + Assertions.assertTrue(model.exclude()); + Assertions.assertEquals(CpuThreshold.FIVE, model.lowCpuThreshold()); + Assertions.assertEquals(DurationModel.ONE_FOUR, model.duration()); + Assertions.assertEquals("ufoxc", model.digests().get(0).name()); + Assertions.assertEquals("opidoamciodh", model.digests().get(0).actionGroupResourceId()); + Assertions.assertEquals(1741139859, model.digests().get(0).frequency()); + Assertions.assertEquals(Category.OPERATIONAL_EXCELLENCE, model.digests().get(0).categories().get(0)); + Assertions.assertEquals("onlwntoeg", model.digests().get(0).language()); Assertions.assertEquals(DigestConfigState.DISABLED, model.digests().get(0).state()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - ConfigDataProperties model = new ConfigDataProperties().withExclude(false) - .withLowCpuThreshold(CpuThreshold.TWO_ZERO) + ConfigDataProperties model = new ConfigDataProperties().withExclude(true) + .withLowCpuThreshold(CpuThreshold.FIVE) + .withDuration(DurationModel.ONE_FOUR) .withDigests(Arrays.asList( - new DigestConfig().withName("lthqtrgqjbp") - .withActionGroupResourceId("fsinzgvfcjrwzoxx") - .withFrequency(1440397986) - .withCategories(Arrays.asList(Category.PERFORMANCE, Category.OPERATIONAL_EXCELLENCE, - Category.HIGH_AVAILABILITY, Category.PERFORMANCE)) - .withLanguage("it") + new DigestConfig().withName("ufoxc") + .withActionGroupResourceId("opidoamciodh") + .withFrequency(1741139859) + .withCategories(Arrays.asList(Category.OPERATIONAL_EXCELLENCE, Category.SECURITY, Category.SECURITY, + Category.PERFORMANCE)) + .withLanguage("onlwntoeg") .withState(DigestConfigState.DISABLED), - new DigestConfig().withName("qfpjk") - .withActionGroupResourceId("xofpdvhpfxxypi") - .withFrequency(7569944) - .withCategories(Arrays.asList(Category.COST, Category.SECURITY)) - .withLanguage("ybb") - .withState(DigestConfigState.DISABLED), - new DigestConfig().withName("epoo") - .withActionGroupResourceId("nuvamiheogna") - .withFrequency(1893731030) + new DigestConfig().withName("bwh") + .withActionGroupResourceId("z") + .withFrequency(793958832) .withCategories( - Arrays.asList(Category.HIGH_AVAILABILITY, Category.HIGH_AVAILABILITY, Category.SECURITY)) - .withLanguage("usivye") - .withState(DigestConfigState.DISABLED))); + Arrays.asList(Category.COST, Category.HIGH_AVAILABILITY, Category.HIGH_AVAILABILITY)) + .withLanguage("vbtqgsfraoyzk") + .withState(DigestConfigState.ACTIVE), + new DigestConfig().withName("lmnguxaw") + .withActionGroupResourceId("ldsyuuximerqfob") + .withFrequency(2077702872) + .withCategories(Arrays.asList(Category.SECURITY)) + .withLanguage("kutwpf") + .withState(DigestConfigState.ACTIVE), + new DigestConfig().withName("m") + .withActionGroupResourceId("skdsnfdsdoakg") + .withFrequency(978154118) + .withCategories(Arrays.asList(Category.SECURITY)) + .withLanguage("evdlh") + .withState(DigestConfigState.ACTIVE))); model = BinaryData.fromObject(model).toObject(ConfigDataProperties.class); - Assertions.assertEquals(false, model.exclude()); - Assertions.assertEquals(CpuThreshold.TWO_ZERO, model.lowCpuThreshold()); - Assertions.assertEquals("lthqtrgqjbp", model.digests().get(0).name()); - Assertions.assertEquals("fsinzgvfcjrwzoxx", model.digests().get(0).actionGroupResourceId()); - Assertions.assertEquals(1440397986, model.digests().get(0).frequency()); - Assertions.assertEquals(Category.PERFORMANCE, model.digests().get(0).categories().get(0)); - Assertions.assertEquals("it", model.digests().get(0).language()); + Assertions.assertTrue(model.exclude()); + Assertions.assertEquals(CpuThreshold.FIVE, model.lowCpuThreshold()); + Assertions.assertEquals(DurationModel.ONE_FOUR, model.duration()); + Assertions.assertEquals("ufoxc", model.digests().get(0).name()); + Assertions.assertEquals("opidoamciodh", model.digests().get(0).actionGroupResourceId()); + Assertions.assertEquals(1741139859, model.digests().get(0).frequency()); + Assertions.assertEquals(Category.OPERATIONAL_EXCELLENCE, model.digests().get(0).categories().get(0)); + Assertions.assertEquals("onlwntoeg", model.digests().get(0).language()); Assertions.assertEquals(DigestConfigState.DISABLED, model.digests().get(0).state()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationListResultTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationListResultTests.java index 0a2048e307a3d..705d93ca355e1 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationListResultTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationListResultTests.java @@ -1,71 +1,33 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.fluent.models.ConfigDataInner; +import com.azure.resourcemanager.advisor.implementation.models.ConfigurationListResult; import com.azure.resourcemanager.advisor.models.Category; -import com.azure.resourcemanager.advisor.models.ConfigurationListResult; import com.azure.resourcemanager.advisor.models.CpuThreshold; -import com.azure.resourcemanager.advisor.models.DigestConfig; import com.azure.resourcemanager.advisor.models.DigestConfigState; -import java.util.Arrays; +import com.azure.resourcemanager.advisor.models.DurationModel; import org.junit.jupiter.api.Assertions; public final class ConfigurationListResultTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ConfigurationListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"exclude\":true,\"lowCpuThreshold\":\"20\",\"digests\":[{\"name\":\"pikxwczbyscnpqxu\",\"actionGroupResourceId\":\"vyq\",\"frequency\":649847293,\"categories\":[\"Performance\"],\"language\":\"k\",\"state\":\"Disabled\"},{\"name\":\"mjgr\",\"actionGroupResourceId\":\"wvukx\",\"frequency\":271346012,\"categories\":[\"Performance\",\"OperationalExcellence\"],\"language\":\"h\",\"state\":\"Disabled\"},{\"name\":\"yejhk\",\"actionGroupResourceId\":\"htnapczwlokjyem\",\"frequency\":1665801665,\"categories\":[\"HighAvailability\",\"Security\",\"OperationalExcellence\",\"HighAvailability\"],\"language\":\"jnchgej\",\"state\":\"Disabled\"}]},\"id\":\"dmailzydehojw\",\"name\":\"ahuxinpm\",\"type\":\"njaqwixjspro\"}],\"nextLink\":\"cputegjvwmfdats\"}") + "{\"value\":[{\"properties\":{\"exclude\":true,\"lowCpuThreshold\":\"5\",\"duration\":\"14\",\"digests\":[{\"name\":\"ewzsyyceuzsoib\",\"actionGroupResourceId\":\"dpfrxtrthzvaytdw\",\"frequency\":1467238377,\"categories\":[\"OperationalExcellence\"],\"language\":\"paxh\",\"state\":\"Disabled\"},{\"name\":\"livpdt\",\"actionGroupResourceId\":\"r\",\"frequency\":54393703,\"categories\":[\"OperationalExcellence\",\"Performance\",\"Cost\"],\"language\":\"uzf\",\"state\":\"Active\"}]},\"id\":\"yfxrx\",\"name\":\"l\",\"type\":\"ptramxj\"},{\"properties\":{\"exclude\":true,\"lowCpuThreshold\":\"15\",\"duration\":\"21\",\"digests\":[{\"name\":\"cvydypatdoo\",\"actionGroupResourceId\":\"jkniodko\",\"frequency\":354248500,\"categories\":[\"Cost\"],\"language\":\"hemms\",\"state\":\"Active\"},{\"name\":\"c\",\"actionGroupResourceId\":\"dtjinfw\",\"frequency\":2087401910,\"categories\":[\"HighAvailability\",\"Security\"],\"language\":\"jvefkdlfoakggkfp\",\"state\":\"Active\"}]},\"id\":\"wpu\",\"name\":\"pqblylsyxkqjnsj\",\"type\":\"r\"},{\"properties\":{\"exclude\":true,\"lowCpuThreshold\":\"15\",\"duration\":\"21\",\"digests\":[{\"name\":\"e\",\"actionGroupResourceId\":\"sbzkf\",\"frequency\":1389741266,\"categories\":[\"OperationalExcellence\"],\"language\":\"qi\",\"state\":\"Disabled\"},{\"name\":\"v\",\"actionGroupResourceId\":\"jxdxrbuukz\",\"frequency\":1482696459,\"categories\":[\"Cost\",\"OperationalExcellence\",\"Security\"],\"language\":\"paztzpofncck\",\"state\":\"Active\"},{\"name\":\"qwhxxbuyqaxzfeqz\",\"actionGroupResourceId\":\"priolx\",\"frequency\":110839155,\"categories\":[\"Security\"],\"language\":\"lmncw\",\"state\":\"Disabled\"}]},\"id\":\"wcsdbnwdcfhucq\",\"name\":\"pfuvglsbjjca\",\"type\":\"vxb\"}],\"nextLink\":\"vudutncor\"}") .toObject(ConfigurationListResult.class); - Assertions.assertEquals(true, model.value().get(0).exclude()); - Assertions.assertEquals(CpuThreshold.TWO_ZERO, model.value().get(0).lowCpuThreshold()); - Assertions.assertEquals("pikxwczbyscnpqxu", model.value().get(0).digests().get(0).name()); - Assertions.assertEquals("vyq", model.value().get(0).digests().get(0).actionGroupResourceId()); - Assertions.assertEquals(649847293, model.value().get(0).digests().get(0).frequency()); - Assertions.assertEquals(Category.PERFORMANCE, model.value().get(0).digests().get(0).categories().get(0)); - Assertions.assertEquals("k", model.value().get(0).digests().get(0).language()); + Assertions.assertTrue(model.value().get(0).exclude()); + Assertions.assertEquals(CpuThreshold.FIVE, model.value().get(0).lowCpuThreshold()); + Assertions.assertEquals(DurationModel.ONE_FOUR, model.value().get(0).duration()); + Assertions.assertEquals("ewzsyyceuzsoib", model.value().get(0).digests().get(0).name()); + Assertions.assertEquals("dpfrxtrthzvaytdw", model.value().get(0).digests().get(0).actionGroupResourceId()); + Assertions.assertEquals(1467238377, model.value().get(0).digests().get(0).frequency()); + Assertions.assertEquals(Category.OPERATIONAL_EXCELLENCE, + model.value().get(0).digests().get(0).categories().get(0)); + Assertions.assertEquals("paxh", model.value().get(0).digests().get(0).language()); Assertions.assertEquals(DigestConfigState.DISABLED, model.value().get(0).digests().get(0).state()); - Assertions.assertEquals("cputegjvwmfdats", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ConfigurationListResult model - = new ConfigurationListResult().withValue(Arrays.asList(new ConfigDataInner().withExclude(true) - .withLowCpuThreshold(CpuThreshold.TWO_ZERO) - .withDigests(Arrays.asList( - new DigestConfig().withName("pikxwczbyscnpqxu") - .withActionGroupResourceId("vyq") - .withFrequency(649847293) - .withCategories(Arrays.asList(Category.PERFORMANCE)) - .withLanguage("k") - .withState(DigestConfigState.DISABLED), - new DigestConfig().withName("mjgr") - .withActionGroupResourceId("wvukx") - .withFrequency(271346012) - .withCategories(Arrays.asList(Category.PERFORMANCE, Category.OPERATIONAL_EXCELLENCE)) - .withLanguage("h") - .withState(DigestConfigState.DISABLED), - new DigestConfig().withName("yejhk") - .withActionGroupResourceId("htnapczwlokjyem") - .withFrequency(1665801665) - .withCategories(Arrays.asList(Category.HIGH_AVAILABILITY, Category.SECURITY, - Category.OPERATIONAL_EXCELLENCE, Category.HIGH_AVAILABILITY)) - .withLanguage("jnchgej") - .withState(DigestConfigState.DISABLED))))) - .withNextLink("cputegjvwmfdats"); - model = BinaryData.fromObject(model).toObject(ConfigurationListResult.class); - Assertions.assertEquals(true, model.value().get(0).exclude()); - Assertions.assertEquals(CpuThreshold.TWO_ZERO, model.value().get(0).lowCpuThreshold()); - Assertions.assertEquals("pikxwczbyscnpqxu", model.value().get(0).digests().get(0).name()); - Assertions.assertEquals("vyq", model.value().get(0).digests().get(0).actionGroupResourceId()); - Assertions.assertEquals(649847293, model.value().get(0).digests().get(0).frequency()); - Assertions.assertEquals(Category.PERFORMANCE, model.value().get(0).digests().get(0).categories().get(0)); - Assertions.assertEquals("k", model.value().get(0).digests().get(0).language()); - Assertions.assertEquals(DigestConfigState.DISABLED, model.value().get(0).digests().get(0).state()); - Assertions.assertEquals("cputegjvwmfdats", model.nextLink()); + Assertions.assertEquals("vudutncor", model.nextLink()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInResourceGroupWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInResourceGroupWithResponseMockTests.java index 8aa6146827815..849db1cc3c719 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInResourceGroupWithResponseMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInResourceGroupWithResponseMockTests.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.models.Category; @@ -16,6 +16,7 @@ import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfig; import com.azure.resourcemanager.advisor.models.DigestConfigState; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import java.util.Arrays; @@ -27,35 +28,37 @@ public final class ConfigurationsCreateInResourceGroupWithResponseMockTests { @Test public void testCreateInResourceGroupWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"exclude\":true,\"lowCpuThreshold\":\"5\",\"digests\":[{\"name\":\"mifthnzdnd\",\"actionGroupResourceId\":\"gnayqigynduh\",\"frequency\":690810711,\"categories\":[\"OperationalExcellence\",\"Cost\"],\"language\":\"umaq\",\"state\":\"Disabled\"}]},\"id\":\"gycdu\",\"name\":\"ertgccymva\",\"type\":\"l\"}"; + = "{\"properties\":{\"exclude\":false,\"lowCpuThreshold\":\"20\",\"duration\":\"30\",\"digests\":[{\"name\":\"rwnamikzeb\",\"actionGroupResourceId\":\"bsmswziqgf\",\"frequency\":1366770562,\"categories\":[\"HighAvailability\",\"Performance\"],\"language\":\"whvhczznvfb\",\"state\":\"Active\"},{\"name\":\"xjww\",\"actionGroupResourceId\":\"z\",\"frequency\":1659306080,\"categories\":[\"Performance\",\"Cost\",\"Performance\",\"Security\"],\"language\":\"vnoamldseha\",\"state\":\"Active\"}]},\"id\":\"hhflzo\",\"name\":\"xcoxpelnjet\",\"type\":\"gltsxoat\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); ConfigData response = manager.configurations() .define(ConfigurationName.DEFAULT) - .withExistingResourceGroup("irx") + .withExistingResourceGroup("xmonstshi") .withExclude(false) .withLowCpuThreshold(CpuThreshold.ONE_ZERO) - .withDigests(Arrays.asList(new DigestConfig().withName("fdtwssotft") - .withActionGroupResourceId("jzbexilzznfq") - .withFrequency(956114198) - .withCategories(Arrays.asList(Category.SECURITY, Category.SECURITY)) - .withLanguage("aruoujmkcjhwqyt") + .withDuration(DurationModel.NINE_ZERO) + .withDigests(Arrays.asList(new DigestConfig().withName("ccbi") + .withActionGroupResourceId("svu") + .withFrequency(73278665) + .withCategories(Arrays.asList(Category.COST, Category.HIGH_AVAILABILITY)) + .withLanguage("tmninw") .withState(DigestConfigState.ACTIVE))) .create(); - Assertions.assertEquals(true, response.exclude()); - Assertions.assertEquals(CpuThreshold.FIVE, response.lowCpuThreshold()); - Assertions.assertEquals("mifthnzdnd", response.digests().get(0).name()); - Assertions.assertEquals("gnayqigynduh", response.digests().get(0).actionGroupResourceId()); - Assertions.assertEquals(690810711, response.digests().get(0).frequency()); - Assertions.assertEquals(Category.OPERATIONAL_EXCELLENCE, response.digests().get(0).categories().get(0)); - Assertions.assertEquals("umaq", response.digests().get(0).language()); - Assertions.assertEquals(DigestConfigState.DISABLED, response.digests().get(0).state()); + Assertions.assertFalse(response.exclude()); + Assertions.assertEquals(CpuThreshold.TWO_ZERO, response.lowCpuThreshold()); + Assertions.assertEquals(DurationModel.THREE_ZERO, response.duration()); + Assertions.assertEquals("rwnamikzeb", response.digests().get(0).name()); + Assertions.assertEquals("bsmswziqgf", response.digests().get(0).actionGroupResourceId()); + Assertions.assertEquals(1366770562, response.digests().get(0).frequency()); + Assertions.assertEquals(Category.HIGH_AVAILABILITY, response.digests().get(0).categories().get(0)); + Assertions.assertEquals("whvhczznvfb", response.digests().get(0).language()); + Assertions.assertEquals(DigestConfigState.ACTIVE, response.digests().get(0).state()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInSubscriptionWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInSubscriptionWithResponseMockTests.java index e1192f1573cae..0be5ed909ce15 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInSubscriptionWithResponseMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInSubscriptionWithResponseMockTests.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.fluent.models.ConfigDataInner; @@ -17,6 +17,7 @@ import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfig; import com.azure.resourcemanager.advisor.models.DigestConfigState; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import java.util.Arrays; @@ -28,58 +29,44 @@ public final class ConfigurationsCreateInSubscriptionWithResponseMockTests { @Test public void testCreateInSubscriptionWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"exclude\":false,\"lowCpuThreshold\":\"15\",\"digests\":[{\"name\":\"xyawj\",\"actionGroupResourceId\":\"aq\",\"frequency\":1260853084,\"categories\":[\"Cost\",\"HighAvailability\",\"Security\",\"Security\"],\"language\":\"zyexzn\",\"state\":\"Active\"},{\"name\":\"hnrztfol\",\"actionGroupResourceId\":\"nxknalaulp\",\"frequency\":809589965,\"categories\":[\"HighAvailability\",\"Performance\",\"HighAvailability\",\"HighAvailability\"],\"language\":\"yiropu\",\"state\":\"Active\"},{\"name\":\"vpgylgqgitxmed\",\"actionGroupResourceId\":\"c\",\"frequency\":1520557842,\"categories\":[\"HighAvailability\",\"Performance\"],\"language\":\"cwzzhxgktr\",\"state\":\"Disabled\"},{\"name\":\"napkteoellw\",\"actionGroupResourceId\":\"fdygpfqbuaceopz\",\"frequency\":1355653581,\"categories\":[\"Cost\",\"HighAvailability\"],\"language\":\"pppcqeqxo\",\"state\":\"Disabled\"}]},\"id\":\"ahzxctobgbk\",\"name\":\"moizpos\",\"type\":\"mgrcfbu\"}"; + = "{\"properties\":{\"exclude\":true,\"lowCpuThreshold\":\"10\",\"duration\":\"7\",\"digests\":[{\"name\":\"gkxkbsazgakg\",\"actionGroupResourceId\":\"yrcmjdmspofap\",\"frequency\":895032308,\"categories\":[\"Cost\",\"Performance\"],\"language\":\"ofrzgb\",\"state\":\"Active\"},{\"name\":\"mstk\",\"actionGroupResourceId\":\"l\",\"frequency\":1553181859,\"categories\":[\"Performance\",\"HighAvailability\",\"Cost\",\"Performance\"],\"language\":\"twfans\",\"state\":\"Disabled\"}]},\"id\":\"ibmikostbzb\",\"name\":\"iwbuqny\",\"type\":\"phzfylsgcrp\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - ConfigData response - = manager.configurations() - .createInSubscriptionWithResponse(ConfigurationName.DEFAULT, - new ConfigDataInner().withExclude(true) - .withLowCpuThreshold(CpuThreshold.TWO_ZERO) - .withDigests( - Arrays.asList( - new DigestConfig().withName("hprwmdyv") - .withActionGroupResourceId("tayriwwroyqbex") - .withFrequency(398335028) - .withCategories( - Arrays.asList(Category.OPERATIONAL_EXCELLENCE, Category.PERFORMANCE)) - .withLanguage("nojvknmefqsg") - .withState(DigestConfigState.ACTIVE), - new DigestConfig().withName("apj") - .withActionGroupResourceId("hpvgqz") - .withFrequency(256612038) - .withCategories( - Arrays.asList(Category.PERFORMANCE, Category.PERFORMANCE, Category.PERFORMANCE)) - .withLanguage("mwlxk") - .withState(DigestConfigState.DISABLED), - new DigestConfig().withName("hzovawjvzunlut") - .withActionGroupResourceId("n") - .withFrequency(1859537611) - .withCategories(Arrays.asList(Category.OPERATIONAL_EXCELLENCE)) - .withLanguage("ilpjzuaejxdult") - .withState(DigestConfigState.DISABLED), - new DigestConfig().withName("btdzumveekg") - .withActionGroupResourceId("ozuhkfp") - .withFrequency(1369679233) - .withCategories(Arrays.asList(Category.HIGH_AVAILABILITY)) - .withLanguage("xl") - .withState(DigestConfigState.ACTIVE))), - com.azure.core.util.Context.NONE) - .getValue(); + ConfigData response = manager.configurations() + .createInSubscriptionWithResponse(ConfigurationName.DEFAULT, + new ConfigDataInner().withExclude(false) + .withLowCpuThreshold(CpuThreshold.FIVE) + .withDuration(DurationModel.SEVEN) + .withDigests(Arrays.asList( + new DigestConfig().withName("sqltnzo") + .withActionGroupResourceId("gsxgnxfyqon") + .withFrequency(1114487691) + .withCategories(Arrays.asList(Category.PERFORMANCE, Category.HIGH_AVAILABILITY)) + .withLanguage("fdbxiqxeiiqbim") + .withState(DigestConfigState.DISABLED), + new DigestConfig().withName("winhehfqpo") + .withActionGroupResourceId("wbcb") + .withFrequency(1104394000) + .withCategories(Arrays.asList(Category.HIGH_AVAILABILITY, Category.HIGH_AVAILABILITY)) + .withLanguage("vqvxk") + .withState(DigestConfigState.DISABLED))), + com.azure.core.util.Context.NONE) + .getValue(); - Assertions.assertEquals(false, response.exclude()); - Assertions.assertEquals(CpuThreshold.ONE_FIVE, response.lowCpuThreshold()); - Assertions.assertEquals("xyawj", response.digests().get(0).name()); - Assertions.assertEquals("aq", response.digests().get(0).actionGroupResourceId()); - Assertions.assertEquals(1260853084, response.digests().get(0).frequency()); + Assertions.assertTrue(response.exclude()); + Assertions.assertEquals(CpuThreshold.ONE_ZERO, response.lowCpuThreshold()); + Assertions.assertEquals(DurationModel.SEVEN, response.duration()); + Assertions.assertEquals("gkxkbsazgakg", response.digests().get(0).name()); + Assertions.assertEquals("yrcmjdmspofap", response.digests().get(0).actionGroupResourceId()); + Assertions.assertEquals(895032308, response.digests().get(0).frequency()); Assertions.assertEquals(Category.COST, response.digests().get(0).categories().get(0)); - Assertions.assertEquals("zyexzn", response.digests().get(0).language()); + Assertions.assertEquals("ofrzgb", response.digests().get(0).language()); Assertions.assertEquals(DigestConfigState.ACTIVE, response.digests().get(0).state()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListByResourceGroupMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListByResourceGroupMockTests.java index 10032fa2e29e1..4fcb0ea285022 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListByResourceGroupMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListByResourceGroupMockTests.java @@ -1,20 +1,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.models.Category; import com.azure.resourcemanager.advisor.models.ConfigData; import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfigState; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; @@ -25,25 +26,26 @@ public final class ConfigurationsListByResourceGroupMockTests { @Test public void testListByResourceGroup() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"exclude\":false,\"lowCpuThreshold\":\"15\",\"digests\":[{\"name\":\"gudivkrtswbxqz\",\"actionGroupResourceId\":\"zjf\",\"frequency\":1306170568,\"categories\":[\"Performance\",\"Performance\",\"HighAvailability\",\"Cost\"],\"language\":\"e\",\"state\":\"Active\"},{\"name\":\"qaqtdoqmcbxvwvxy\",\"actionGroupResourceId\":\"qbhsfxobl\",\"frequency\":97190015,\"categories\":[\"Performance\",\"Performance\",\"HighAvailability\"],\"language\":\"wwfbkrvrnsvshq\",\"state\":\"Active\"}]},\"id\":\"xc\",\"name\":\"sbfov\",\"type\":\"srruvwbhsqfsubcg\"}]}"; + = "{\"value\":[{\"properties\":{\"exclude\":true,\"lowCpuThreshold\":\"5\",\"duration\":\"30\",\"digests\":[{\"name\":\"etnpsihcl\",\"actionGroupResourceId\":\"zvaylptrsqqw\",\"frequency\":794270999,\"categories\":[\"Performance\"],\"language\":\"chcxwaxfewzj\",\"state\":\"Disabled\"},{\"name\":\"fdeqvhpsyl\",\"actionGroupResourceId\":\"shk\",\"frequency\":127913719,\"categories\":[\"Security\",\"HighAvailability\",\"Security\"],\"language\":\"rgywwp\",\"state\":\"Active\"},{\"name\":\"nptfujgi\",\"actionGroupResourceId\":\"aaoepttaqut\",\"frequency\":1146878861,\"categories\":[\"HighAvailability\",\"Cost\",\"Cost\"],\"language\":\"ruunzzjgehkf\",\"state\":\"Active\"}]},\"id\":\"tixo\",\"name\":\"ffqyinlj\",\"type\":\"epqw\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); PagedIterable response - = manager.configurations().listByResourceGroup("rmfqjhhkxbpvj", com.azure.core.util.Context.NONE); + = manager.configurations().listByResourceGroup("bcunezzceze", com.azure.core.util.Context.NONE); - Assertions.assertEquals(false, response.iterator().next().exclude()); - Assertions.assertEquals(CpuThreshold.ONE_FIVE, response.iterator().next().lowCpuThreshold()); - Assertions.assertEquals("gudivkrtswbxqz", response.iterator().next().digests().get(0).name()); - Assertions.assertEquals("zjf", response.iterator().next().digests().get(0).actionGroupResourceId()); - Assertions.assertEquals(1306170568, response.iterator().next().digests().get(0).frequency()); + Assertions.assertTrue(response.iterator().next().exclude()); + Assertions.assertEquals(CpuThreshold.FIVE, response.iterator().next().lowCpuThreshold()); + Assertions.assertEquals(DurationModel.THREE_ZERO, response.iterator().next().duration()); + Assertions.assertEquals("etnpsihcl", response.iterator().next().digests().get(0).name()); + Assertions.assertEquals("zvaylptrsqqw", response.iterator().next().digests().get(0).actionGroupResourceId()); + Assertions.assertEquals(794270999, response.iterator().next().digests().get(0).frequency()); Assertions.assertEquals(Category.PERFORMANCE, response.iterator().next().digests().get(0).categories().get(0)); - Assertions.assertEquals("e", response.iterator().next().digests().get(0).language()); - Assertions.assertEquals(DigestConfigState.ACTIVE, response.iterator().next().digests().get(0).state()); + Assertions.assertEquals("chcxwaxfewzj", response.iterator().next().digests().get(0).language()); + Assertions.assertEquals(DigestConfigState.DISABLED, response.iterator().next().digests().get(0).state()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListMockTests.java index e49d3db76be05..ea8f6149c41cf 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListMockTests.java @@ -1,20 +1,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.models.Category; import com.azure.resourcemanager.advisor.models.ConfigData; import com.azure.resourcemanager.advisor.models.CpuThreshold; import com.azure.resourcemanager.advisor.models.DigestConfigState; +import com.azure.resourcemanager.advisor.models.DurationModel; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; import org.junit.jupiter.api.Assertions; @@ -25,24 +26,25 @@ public final class ConfigurationsListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"exclude\":false,\"lowCpuThreshold\":\"10\",\"digests\":[{\"name\":\"gxhnisk\",\"actionGroupResourceId\":\"bkpyc\",\"frequency\":746894532,\"categories\":[\"Security\",\"Performance\"],\"language\":\"jdauwhvy\",\"state\":\"Active\"},{\"name\":\"tdhxujznbmpowuwp\",\"actionGroupResourceId\":\"qlveualupjmkh\",\"frequency\":1026184790,\"categories\":[\"Security\",\"HighAvailability\"],\"language\":\"s\",\"state\":\"Disabled\"},{\"name\":\"iplrbpbewtghfgb\",\"actionGroupResourceId\":\"gw\",\"frequency\":748159283,\"categories\":[\"Cost\"],\"language\":\"jkbegibtnmxiebww\",\"state\":\"Active\"}]},\"id\":\"ayqcgw\",\"name\":\"tzjuzgwyzmhtxo\",\"type\":\"gmtsavjcbpwxqpsr\"}]}"; + = "{\"value\":[{\"properties\":{\"exclude\":false,\"lowCpuThreshold\":\"15\",\"duration\":\"14\",\"digests\":[{\"name\":\"uamwabzxrvxc\",\"actionGroupResourceId\":\"hsphaivmxyas\",\"frequency\":1805110370,\"categories\":[\"Cost\",\"HighAvailability\",\"Security\",\"HighAvailability\"],\"language\":\"akoi\",\"state\":\"Active\"}]},\"id\":\"mjblmljhlny\",\"name\":\"zotqyryuzcb\",\"type\":\"qqvxmvwfgtayxons\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); PagedIterable response = manager.configurations().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals(false, response.iterator().next().exclude()); - Assertions.assertEquals(CpuThreshold.ONE_ZERO, response.iterator().next().lowCpuThreshold()); - Assertions.assertEquals("gxhnisk", response.iterator().next().digests().get(0).name()); - Assertions.assertEquals("bkpyc", response.iterator().next().digests().get(0).actionGroupResourceId()); - Assertions.assertEquals(746894532, response.iterator().next().digests().get(0).frequency()); - Assertions.assertEquals(Category.SECURITY, response.iterator().next().digests().get(0).categories().get(0)); - Assertions.assertEquals("jdauwhvy", response.iterator().next().digests().get(0).language()); + Assertions.assertFalse(response.iterator().next().exclude()); + Assertions.assertEquals(CpuThreshold.ONE_FIVE, response.iterator().next().lowCpuThreshold()); + Assertions.assertEquals(DurationModel.ONE_FOUR, response.iterator().next().duration()); + Assertions.assertEquals("uamwabzxrvxc", response.iterator().next().digests().get(0).name()); + Assertions.assertEquals("hsphaivmxyas", response.iterator().next().digests().get(0).actionGroupResourceId()); + Assertions.assertEquals(1805110370, response.iterator().next().digests().get(0).frequency()); + Assertions.assertEquals(Category.COST, response.iterator().next().digests().get(0).categories().get(0)); + Assertions.assertEquals("akoi", response.iterator().next().digests().get(0).language()); Assertions.assertEquals(DigestConfigState.ACTIVE, response.iterator().next().digests().get(0).state()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/DigestConfigTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/DigestConfigTests.java index aa6d91c0d2c1a..1c8666a142a43 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/DigestConfigTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/DigestConfigTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -15,30 +15,30 @@ public final class DigestConfigTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { DigestConfig model = BinaryData.fromString( - "{\"name\":\"qi\",\"actionGroupResourceId\":\"hungbwjzrnf\",\"frequency\":1847576577,\"categories\":[\"OperationalExcellence\"],\"language\":\"emv\",\"state\":\"Active\"}") + "{\"name\":\"sdsttwvog\",\"actionGroupResourceId\":\"bejdcn\",\"frequency\":963593520,\"categories\":[\"Security\",\"HighAvailability\"],\"language\":\"fgmjzrwrdgrt\",\"state\":\"Disabled\"}") .toObject(DigestConfig.class); - Assertions.assertEquals("qi", model.name()); - Assertions.assertEquals("hungbwjzrnf", model.actionGroupResourceId()); - Assertions.assertEquals(1847576577, model.frequency()); - Assertions.assertEquals(Category.OPERATIONAL_EXCELLENCE, model.categories().get(0)); - Assertions.assertEquals("emv", model.language()); - Assertions.assertEquals(DigestConfigState.ACTIVE, model.state()); + Assertions.assertEquals("sdsttwvog", model.name()); + Assertions.assertEquals("bejdcn", model.actionGroupResourceId()); + Assertions.assertEquals(963593520, model.frequency()); + Assertions.assertEquals(Category.SECURITY, model.categories().get(0)); + Assertions.assertEquals("fgmjzrwrdgrt", model.language()); + Assertions.assertEquals(DigestConfigState.DISABLED, model.state()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - DigestConfig model = new DigestConfig().withName("qi") - .withActionGroupResourceId("hungbwjzrnf") - .withFrequency(1847576577) - .withCategories(Arrays.asList(Category.OPERATIONAL_EXCELLENCE)) - .withLanguage("emv") - .withState(DigestConfigState.ACTIVE); + DigestConfig model = new DigestConfig().withName("sdsttwvog") + .withActionGroupResourceId("bejdcn") + .withFrequency(963593520) + .withCategories(Arrays.asList(Category.SECURITY, Category.HIGH_AVAILABILITY)) + .withLanguage("fgmjzrwrdgrt") + .withState(DigestConfigState.DISABLED); model = BinaryData.fromObject(model).toObject(DigestConfig.class); - Assertions.assertEquals("qi", model.name()); - Assertions.assertEquals("hungbwjzrnf", model.actionGroupResourceId()); - Assertions.assertEquals(1847576577, model.frequency()); - Assertions.assertEquals(Category.OPERATIONAL_EXCELLENCE, model.categories().get(0)); - Assertions.assertEquals("emv", model.language()); - Assertions.assertEquals(DigestConfigState.ACTIVE, model.state()); + Assertions.assertEquals("sdsttwvog", model.name()); + Assertions.assertEquals("bejdcn", model.actionGroupResourceId()); + Assertions.assertEquals(963593520, model.frequency()); + Assertions.assertEquals(Category.SECURITY, model.categories().get(0)); + Assertions.assertEquals("fgmjzrwrdgrt", model.language()); + Assertions.assertEquals(DigestConfigState.DISABLED, model.state()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityInnerTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityInnerTests.java index 1a3c655bd3767..dccb5dfe840da 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityInnerTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityInnerTests.java @@ -1,51 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.util.BinaryData; import com.azure.resourcemanager.advisor.fluent.models.MetadataEntityInner; -import com.azure.resourcemanager.advisor.models.MetadataSupportedValueDetail; import com.azure.resourcemanager.advisor.models.Scenario; -import java.util.Arrays; import org.junit.jupiter.api.Assertions; public final class MetadataEntityInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { MetadataEntityInner model = BinaryData.fromString( - "{\"id\":\"mhquvgjxp\",\"type\":\"czmehmtzopbsp\",\"name\":\"upi\",\"properties\":{\"displayName\":\"ybbejhph\",\"dependsOn\":[\"msxaobhd\",\"bmtqioq\",\"zehtbmu\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\"],\"supportedValues\":[{\"id\":\"hwlrx\",\"displayName\":\"qsoqijgkd\"},{\"id\":\"pazlobcufpdz\",\"displayName\":\"btcqq\"}]}}") + "{\"properties\":{\"displayName\":\"jbpzvgnwzsymg\",\"dependsOn\":[\"fcyzkohdbihanufh\"],\"applicableScenarios\":[\"Alerts\"],\"supportedValues\":[{\"id\":\"git\",\"displayName\":\"qhabifpikxwcz\"}]},\"id\":\"scnpqxuhivy\",\"name\":\"n\",\"type\":\"wby\"}") .toObject(MetadataEntityInner.class); - Assertions.assertEquals("mhquvgjxp", model.id()); - Assertions.assertEquals("czmehmtzopbsp", model.type()); - Assertions.assertEquals("upi", model.name()); - Assertions.assertEquals("ybbejhph", model.displayName()); - Assertions.assertEquals("msxaobhd", model.dependsOn().get(0)); + Assertions.assertEquals("jbpzvgnwzsymg", model.displayName()); + Assertions.assertEquals("fcyzkohdbihanufh", model.dependsOn().get(0)); Assertions.assertEquals(Scenario.ALERTS, model.applicableScenarios().get(0)); - Assertions.assertEquals("hwlrx", model.supportedValues().get(0).id()); - Assertions.assertEquals("qsoqijgkd", model.supportedValues().get(0).displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MetadataEntityInner model = new MetadataEntityInner().withId("mhquvgjxp") - .withType("czmehmtzopbsp") - .withName("upi") - .withDisplayName("ybbejhph") - .withDependsOn(Arrays.asList("msxaobhd", "bmtqioq", "zehtbmu")) - .withApplicableScenarios(Arrays.asList(Scenario.ALERTS, Scenario.ALERTS)) - .withSupportedValues( - Arrays.asList(new MetadataSupportedValueDetail().withId("hwlrx").withDisplayName("qsoqijgkd"), - new MetadataSupportedValueDetail().withId("pazlobcufpdz").withDisplayName("btcqq"))); - model = BinaryData.fromObject(model).toObject(MetadataEntityInner.class); - Assertions.assertEquals("mhquvgjxp", model.id()); - Assertions.assertEquals("czmehmtzopbsp", model.type()); - Assertions.assertEquals("upi", model.name()); - Assertions.assertEquals("ybbejhph", model.displayName()); - Assertions.assertEquals("msxaobhd", model.dependsOn().get(0)); - Assertions.assertEquals(Scenario.ALERTS, model.applicableScenarios().get(0)); - Assertions.assertEquals("hwlrx", model.supportedValues().get(0).id()); - Assertions.assertEquals("qsoqijgkd", model.supportedValues().get(0).displayName()); + Assertions.assertEquals("git", model.supportedValues().get(0).id()); + Assertions.assertEquals("qhabifpikxwcz", model.supportedValues().get(0).displayName()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityListResultTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityListResultTests.java index f7d7e5e6b5ebd..dc57716ae119a 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityListResultTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityListResultTests.java @@ -1,59 +1,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.fluent.models.MetadataEntityInner; -import com.azure.resourcemanager.advisor.models.MetadataEntityListResult; -import com.azure.resourcemanager.advisor.models.MetadataSupportedValueDetail; +import com.azure.resourcemanager.advisor.implementation.models.MetadataEntityListResult; import com.azure.resourcemanager.advisor.models.Scenario; -import java.util.Arrays; import org.junit.jupiter.api.Assertions; public final class MetadataEntityListResultTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { MetadataEntityListResult model = BinaryData.fromString( - "{\"value\":[{\"id\":\"fdkfogk\",\"type\":\"gjofjd\",\"name\":\"qs\",\"properties\":{\"displayName\":\"upewnwreitjzy\",\"dependsOn\":[\"sarhmofc\",\"hs\",\"yurkdtmlxhekuksj\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\",\"Alerts\",\"Alerts\"],\"supportedValues\":[{\"id\":\"cryuan\",\"displayName\":\"uxzdxtay\"},{\"id\":\"hmwhfpmrqo\",\"displayName\":\"tu\"},{\"id\":\"nryrtihf\",\"displayName\":\"ijbpzvgnwzsymgl\"},{\"id\":\"fcyzkohdbihanufh\",\"displayName\":\"bj\"}]}}],\"nextLink\":\"a\"}") + "{\"value\":[{\"properties\":{\"displayName\":\"jvwmfda\",\"dependsOn\":[\"mdvpjhulsu\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\",\"Alerts\"],\"supportedValues\":[{\"id\":\"wfndiodjpsl\",\"displayName\":\"jdpvwryo\"}]},\"id\":\"soacctazakl\",\"name\":\"lahbcryff\",\"type\":\"fdosyg\"},{\"properties\":{\"displayName\":\"aojakhmsbzjhcrz\",\"dependsOn\":[\"phlxa\",\"lthqtrgqjbp\",\"zfsinzgvf\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\",\"Alerts\",\"Alerts\"],\"supportedValues\":[{\"id\":\"felluwfzitonpe\",\"displayName\":\"pjkjlxofpdv\"}]},\"id\":\"fxxypininmayhuy\",\"name\":\"bkpodepooginuv\",\"type\":\"mihe\"}],\"nextLink\":\"narxzxtheotus\"}") .toObject(MetadataEntityListResult.class); - Assertions.assertEquals("fdkfogk", model.value().get(0).id()); - Assertions.assertEquals("gjofjd", model.value().get(0).type()); - Assertions.assertEquals("qs", model.value().get(0).name()); - Assertions.assertEquals("upewnwreitjzy", model.value().get(0).displayName()); - Assertions.assertEquals("sarhmofc", model.value().get(0).dependsOn().get(0)); + Assertions.assertEquals("jvwmfda", model.value().get(0).displayName()); + Assertions.assertEquals("mdvpjhulsu", model.value().get(0).dependsOn().get(0)); Assertions.assertEquals(Scenario.ALERTS, model.value().get(0).applicableScenarios().get(0)); - Assertions.assertEquals("cryuan", model.value().get(0).supportedValues().get(0).id()); - Assertions.assertEquals("uxzdxtay", model.value().get(0).supportedValues().get(0).displayName()); - Assertions.assertEquals("a", model.nextLink()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MetadataEntityListResult model = new MetadataEntityListResult() - .withValue(Arrays.asList(new MetadataEntityInner().withId("fdkfogk") - .withType("gjofjd") - .withName("qs") - .withDisplayName("upewnwreitjzy") - .withDependsOn(Arrays.asList("sarhmofc", "hs", "yurkdtmlxhekuksj")) - .withApplicableScenarios( - Arrays.asList(Scenario.ALERTS, Scenario.ALERTS, Scenario.ALERTS, Scenario.ALERTS)) - .withSupportedValues( - Arrays.asList(new MetadataSupportedValueDetail().withId("cryuan").withDisplayName("uxzdxtay"), - new MetadataSupportedValueDetail().withId("hmwhfpmrqo").withDisplayName("tu"), - new MetadataSupportedValueDetail().withId("nryrtihf").withDisplayName("ijbpzvgnwzsymgl"), - new MetadataSupportedValueDetail().withId("fcyzkohdbihanufh").withDisplayName("bj"))))) - .withNextLink("a"); - model = BinaryData.fromObject(model).toObject(MetadataEntityListResult.class); - Assertions.assertEquals("fdkfogk", model.value().get(0).id()); - Assertions.assertEquals("gjofjd", model.value().get(0).type()); - Assertions.assertEquals("qs", model.value().get(0).name()); - Assertions.assertEquals("upewnwreitjzy", model.value().get(0).displayName()); - Assertions.assertEquals("sarhmofc", model.value().get(0).dependsOn().get(0)); - Assertions.assertEquals(Scenario.ALERTS, model.value().get(0).applicableScenarios().get(0)); - Assertions.assertEquals("cryuan", model.value().get(0).supportedValues().get(0).id()); - Assertions.assertEquals("uxzdxtay", model.value().get(0).supportedValues().get(0).displayName()); - Assertions.assertEquals("a", model.nextLink()); + Assertions.assertEquals("wfndiodjpsl", model.value().get(0).supportedValues().get(0).id()); + Assertions.assertEquals("jdpvwryo", model.value().get(0).supportedValues().get(0).displayName()); + Assertions.assertEquals("narxzxtheotus", model.nextLink()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityPropertiesTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityPropertiesTests.java index 2ad3211d7a4e8..68b87c4439ca8 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityPropertiesTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityPropertiesTests.java @@ -1,41 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.util.BinaryData; import com.azure.resourcemanager.advisor.fluent.models.MetadataEntityProperties; -import com.azure.resourcemanager.advisor.models.MetadataSupportedValueDetail; import com.azure.resourcemanager.advisor.models.Scenario; -import java.util.Arrays; import org.junit.jupiter.api.Assertions; public final class MetadataEntityPropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { MetadataEntityProperties model = BinaryData.fromString( - "{\"displayName\":\"qglhq\",\"dependsOn\":[\"foooj\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\",\"Alerts\",\"Alerts\"],\"supportedValues\":[{\"id\":\"gdf\",\"displayName\":\"lzl\"},{\"id\":\"xrifkwmrvkts\",\"displayName\":\"nt\"}]}") + "{\"displayName\":\"k\",\"dependsOn\":[\"umjgrtfwvuk\",\"gaudcc\",\"nhsjcnyej\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\",\"Alerts\",\"Alerts\"],\"supportedValues\":[{\"id\":\"zw\",\"displayName\":\"kjyemkk\"},{\"id\":\"ipjoxzjnchgejs\",\"displayName\":\"dmailzydehojw\"}]}") .toObject(MetadataEntityProperties.class); - Assertions.assertEquals("qglhq", model.displayName()); - Assertions.assertEquals("foooj", model.dependsOn().get(0)); + Assertions.assertEquals("k", model.displayName()); + Assertions.assertEquals("umjgrtfwvuk", model.dependsOn().get(0)); Assertions.assertEquals(Scenario.ALERTS, model.applicableScenarios().get(0)); - Assertions.assertEquals("gdf", model.supportedValues().get(0).id()); - Assertions.assertEquals("lzl", model.supportedValues().get(0).displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MetadataEntityProperties model = new MetadataEntityProperties().withDisplayName("qglhq") - .withDependsOn(Arrays.asList("foooj")) - .withApplicableScenarios(Arrays.asList(Scenario.ALERTS, Scenario.ALERTS, Scenario.ALERTS, Scenario.ALERTS)) - .withSupportedValues(Arrays.asList(new MetadataSupportedValueDetail().withId("gdf").withDisplayName("lzl"), - new MetadataSupportedValueDetail().withId("xrifkwmrvkts").withDisplayName("nt"))); - model = BinaryData.fromObject(model).toObject(MetadataEntityProperties.class); - Assertions.assertEquals("qglhq", model.displayName()); - Assertions.assertEquals("foooj", model.dependsOn().get(0)); - Assertions.assertEquals(Scenario.ALERTS, model.applicableScenarios().get(0)); - Assertions.assertEquals("gdf", model.supportedValues().get(0).id()); - Assertions.assertEquals("lzl", model.supportedValues().get(0).displayName()); + Assertions.assertEquals("zw", model.supportedValues().get(0).id()); + Assertions.assertEquals("kjyemkk", model.supportedValues().get(0).displayName()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataSupportedValueDetailTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataSupportedValueDetailTests.java index bff8bb660f54a..1d3ef73040ce0 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataSupportedValueDetailTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataSupportedValueDetailTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -11,18 +11,10 @@ public final class MetadataSupportedValueDetailTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - MetadataSupportedValueDetail model = BinaryData.fromString("{\"id\":\"ipa\",\"displayName\":\"ajpsquc\"}") - .toObject(MetadataSupportedValueDetail.class); - Assertions.assertEquals("ipa", model.id()); - Assertions.assertEquals("ajpsquc", model.displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { MetadataSupportedValueDetail model - = new MetadataSupportedValueDetail().withId("ipa").withDisplayName("ajpsquc"); - model = BinaryData.fromObject(model).toObject(MetadataSupportedValueDetail.class); - Assertions.assertEquals("ipa", model.id()); - Assertions.assertEquals("ajpsquc", model.displayName()); + = BinaryData.fromString("{\"id\":\"huxinpmqnj\",\"displayName\":\"wixjsprozvcp\"}") + .toObject(MetadataSupportedValueDetail.class); + Assertions.assertEquals("huxinpmqnj", model.id()); + Assertions.assertEquals("wixjsprozvcp", model.displayName()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationDisplayInfoTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationDisplayInfoTests.java index 70d249fef21c4..6d29ed5a3cce4 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationDisplayInfoTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationDisplayInfoTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -11,26 +11,12 @@ public final class OperationDisplayInfoTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - OperationDisplayInfo model = BinaryData - .fromString( - "{\"description\":\"cuh\",\"operation\":\"tcty\",\"provider\":\"klbb\",\"resource\":\"plwzbhvgyugu\"}") + OperationDisplayInfo model = BinaryData.fromString( + "{\"description\":\"uxzdxtay\",\"operation\":\"hmwhfpmrqo\",\"provider\":\"tu\",\"resource\":\"nryrtihf\"}") .toObject(OperationDisplayInfo.class); - Assertions.assertEquals("cuh", model.description()); - Assertions.assertEquals("tcty", model.operation()); - Assertions.assertEquals("klbb", model.provider()); - Assertions.assertEquals("plwzbhvgyugu", model.resource()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplayInfo model = new OperationDisplayInfo().withDescription("cuh") - .withOperation("tcty") - .withProvider("klbb") - .withResource("plwzbhvgyugu"); - model = BinaryData.fromObject(model).toObject(OperationDisplayInfo.class); - Assertions.assertEquals("cuh", model.description()); - Assertions.assertEquals("tcty", model.operation()); - Assertions.assertEquals("klbb", model.provider()); - Assertions.assertEquals("plwzbhvgyugu", model.resource()); + Assertions.assertEquals("uxzdxtay", model.description()); + Assertions.assertEquals("hmwhfpmrqo", model.operation()); + Assertions.assertEquals("tu", model.provider()); + Assertions.assertEquals("nryrtihf", model.resource()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationEntityInnerTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationEntityInnerTests.java index 454733e26df37..1f254dc9daabf 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationEntityInnerTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationEntityInnerTests.java @@ -1,39 +1,23 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.util.BinaryData; import com.azure.resourcemanager.advisor.fluent.models.OperationEntityInner; -import com.azure.resourcemanager.advisor.models.OperationDisplayInfo; import org.junit.jupiter.api.Assertions; public final class OperationEntityInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { OperationEntityInner model = BinaryData.fromString( - "{\"name\":\"qwalmuzyoxaepd\",\"display\":{\"description\":\"ancuxrhd\",\"operation\":\"avxbniwdjswztsdb\",\"provider\":\"nxytxh\",\"resource\":\"xbzpfzab\"}}") + "{\"name\":\"lusarh\",\"display\":{\"description\":\"cqhsm\",\"operation\":\"rkdtmlxh\",\"provider\":\"uksjtxukcdmp\",\"resource\":\"cryuan\"}}") .toObject(OperationEntityInner.class); - Assertions.assertEquals("qwalmuzyoxaepd", model.name()); - Assertions.assertEquals("ancuxrhd", model.display().description()); - Assertions.assertEquals("avxbniwdjswztsdb", model.display().operation()); - Assertions.assertEquals("nxytxh", model.display().provider()); - Assertions.assertEquals("xbzpfzab", model.display().resource()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationEntityInner model = new OperationEntityInner().withName("qwalmuzyoxaepd") - .withDisplay(new OperationDisplayInfo().withDescription("ancuxrhd") - .withOperation("avxbniwdjswztsdb") - .withProvider("nxytxh") - .withResource("xbzpfzab")); - model = BinaryData.fromObject(model).toObject(OperationEntityInner.class); - Assertions.assertEquals("qwalmuzyoxaepd", model.name()); - Assertions.assertEquals("ancuxrhd", model.display().description()); - Assertions.assertEquals("avxbniwdjswztsdb", model.display().operation()); - Assertions.assertEquals("nxytxh", model.display().provider()); - Assertions.assertEquals("xbzpfzab", model.display().resource()); + Assertions.assertEquals("lusarh", model.name()); + Assertions.assertEquals("cqhsm", model.display().description()); + Assertions.assertEquals("rkdtmlxh", model.display().operation()); + Assertions.assertEquals("uksjtxukcdmp", model.display().provider()); + Assertions.assertEquals("cryuan", model.display().resource()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationEntityListResultTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationEntityListResultTests.java index 6310da56a44d6..5b84f8e9447f2 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationEntityListResultTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationEntityListResultTests.java @@ -1,60 +1,24 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.fluent.models.OperationEntityInner; -import com.azure.resourcemanager.advisor.models.OperationDisplayInfo; -import com.azure.resourcemanager.advisor.models.OperationEntityListResult; -import java.util.Arrays; +import com.azure.resourcemanager.advisor.implementation.models.OperationEntityListResult; import org.junit.jupiter.api.Assertions; public final class OperationEntityListResultTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { OperationEntityListResult model = BinaryData.fromString( - "{\"nextLink\":\"mpukgriw\",\"value\":[{\"name\":\"fbxzpuzycisp\",\"display\":{\"description\":\"ahmgkbrp\",\"operation\":\"dhibnuq\",\"provider\":\"pikad\",\"resource\":\"vtq\"}},{\"name\":\"n\",\"display\":{\"description\":\"nhijggmebfsi\",\"operation\":\"butr\",\"provider\":\"pnazzm\",\"resource\":\"runmp\"}},{\"name\":\"tdbhrbnla\",\"display\":{\"description\":\"myskpbhenbtkcxy\",\"operation\":\"y\",\"provider\":\"rsyn\",\"resource\":\"idybyxczf\"}},{\"name\":\"haaxdbabphl\",\"display\":{\"description\":\"lfktsths\",\"operation\":\"ocmnyyazttbtwwrq\",\"provider\":\"edckzywbiexzfey\",\"resource\":\"axibxujw\"}}]}") + "{\"value\":[{\"name\":\"wmrvktsizntocipa\",\"display\":{\"description\":\"jpsq\",\"operation\":\"mpoyfd\",\"provider\":\"ogknygjofjdd\",\"resource\":\"s\"}}],\"nextLink\":\"eupewnwreitjz\"}") .toObject(OperationEntityListResult.class); - Assertions.assertEquals("mpukgriw", model.nextLink()); - Assertions.assertEquals("fbxzpuzycisp", model.value().get(0).name()); - Assertions.assertEquals("ahmgkbrp", model.value().get(0).display().description()); - Assertions.assertEquals("dhibnuq", model.value().get(0).display().operation()); - Assertions.assertEquals("pikad", model.value().get(0).display().provider()); - Assertions.assertEquals("vtq", model.value().get(0).display().resource()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationEntityListResult model = new OperationEntityListResult().withNextLink("mpukgriw") - .withValue(Arrays.asList( - new OperationEntityInner().withName("fbxzpuzycisp") - .withDisplay(new OperationDisplayInfo().withDescription("ahmgkbrp") - .withOperation("dhibnuq") - .withProvider("pikad") - .withResource("vtq")), - new OperationEntityInner().withName("n") - .withDisplay(new OperationDisplayInfo().withDescription("nhijggmebfsi") - .withOperation("butr") - .withProvider("pnazzm") - .withResource("runmp")), - new OperationEntityInner().withName("tdbhrbnla") - .withDisplay(new OperationDisplayInfo().withDescription("myskpbhenbtkcxy") - .withOperation("y") - .withProvider("rsyn") - .withResource("idybyxczf")), - new OperationEntityInner().withName("haaxdbabphl") - .withDisplay(new OperationDisplayInfo().withDescription("lfktsths") - .withOperation("ocmnyyazttbtwwrq") - .withProvider("edckzywbiexzfey") - .withResource("axibxujw")))); - model = BinaryData.fromObject(model).toObject(OperationEntityListResult.class); - Assertions.assertEquals("mpukgriw", model.nextLink()); - Assertions.assertEquals("fbxzpuzycisp", model.value().get(0).name()); - Assertions.assertEquals("ahmgkbrp", model.value().get(0).display().description()); - Assertions.assertEquals("dhibnuq", model.value().get(0).display().operation()); - Assertions.assertEquals("pikad", model.value().get(0).display().provider()); - Assertions.assertEquals("vtq", model.value().get(0).display().resource()); + Assertions.assertEquals("wmrvktsizntocipa", model.value().get(0).name()); + Assertions.assertEquals("jpsq", model.value().get(0).display().description()); + Assertions.assertEquals("mpoyfd", model.value().get(0).display().operation()); + Assertions.assertEquals("ogknygjofjdd", model.value().get(0).display().provider()); + Assertions.assertEquals("s", model.value().get(0).display().resource()); + Assertions.assertEquals("eupewnwreitjz", model.nextLink()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationsListMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationsListMockTests.java index c23e100b8ed40..6b32e7be3a5ed 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationsListMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationsListMockTests.java @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.models.OperationEntity; @@ -22,21 +22,21 @@ public final class OperationsListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"name\":\"imjwosyt\",\"display\":{\"description\":\"cskfcktqumiekk\",\"operation\":\"zikhl\",\"provider\":\"jhdgqggebdunyga\",\"resource\":\"idb\"}}]}"; + = "{\"value\":[{\"name\":\"ouw\",\"display\":{\"description\":\"zrfze\",\"operation\":\"ebizikayuh\",\"provider\":\"bjbsybb\",\"resource\":\"r\"}}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("imjwosyt", response.iterator().next().name()); - Assertions.assertEquals("cskfcktqumiekk", response.iterator().next().display().description()); - Assertions.assertEquals("zikhl", response.iterator().next().display().operation()); - Assertions.assertEquals("jhdgqggebdunyga", response.iterator().next().display().provider()); - Assertions.assertEquals("idb", response.iterator().next().display().resource()); + Assertions.assertEquals("ouw", response.iterator().next().name()); + Assertions.assertEquals("zrfze", response.iterator().next().display().description()); + Assertions.assertEquals("ebizikayuh", response.iterator().next().display().operation()); + Assertions.assertEquals("bjbsybb", response.iterator().next().display().provider()); + Assertions.assertEquals("r", response.iterator().next().display().resource()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionRequestPropertiesTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionRequestPropertiesTests.java new file mode 100644 index 0000000000000..34fc21078430e --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionRequestPropertiesTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.PredictionRequestProperties; +import com.azure.resourcemanager.advisor.models.PredictionType; +import java.nio.charset.StandardCharsets; +import org.junit.jupiter.api.Assertions; + +public final class PredictionRequestPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PredictionRequestProperties model = BinaryData + .fromString( + "{\"predictionType\":\"PredictiveRightsizing\",\"extendedProperties\":\"\\\"dataybczmehmtzo\\\"\"}") + .toObject(PredictionRequestProperties.class); + Assertions.assertEquals(PredictionType.PREDICTIVE_RIGHTSIZING, model.predictionType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PredictionRequestProperties model + = new PredictionRequestProperties().withPredictionType(PredictionType.PREDICTIVE_RIGHTSIZING) + .withExtendedProperties(BinaryData.fromBytes("\"dataybczmehmtzo\"".getBytes(StandardCharsets.UTF_8))); + model = BinaryData.fromObject(model).toObject(PredictionRequestProperties.class); + Assertions.assertEquals(PredictionType.PREDICTIVE_RIGHTSIZING, model.predictionType()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionRequestTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionRequestTests.java new file mode 100644 index 0000000000000..787b83e209958 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionRequestTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.PredictionRequest; +import com.azure.resourcemanager.advisor.models.PredictionType; +import java.nio.charset.StandardCharsets; +import org.junit.jupiter.api.Assertions; + +public final class PredictionRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PredictionRequest model = BinaryData.fromString( + "{\"properties\":{\"predictionType\":\"PredictiveRightsizing\",\"extendedProperties\":\"\\\"datauv\\\"\"}}") + .toObject(PredictionRequest.class); + Assertions.assertEquals(PredictionType.PREDICTIVE_RIGHTSIZING, model.predictionType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PredictionRequest model = new PredictionRequest().withPredictionType(PredictionType.PREDICTIVE_RIGHTSIZING) + .withExtendedProperties(BinaryData.fromBytes("\"datauv\"".getBytes(StandardCharsets.UTF_8))); + model = BinaryData.fromObject(model).toObject(PredictionRequest.class); + Assertions.assertEquals(PredictionType.PREDICTIVE_RIGHTSIZING, model.predictionType()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionResponseInnerTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionResponseInnerTests.java new file mode 100644 index 0000000000000..0e443716a3a7a --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionResponseInnerTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.PredictionResponseInner; +import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.PredictionType; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class PredictionResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PredictionResponseInner model = BinaryData.fromString( + "{\"properties\":{\"extendedProperties\":\"\\\"dataphrupidgsybbejhp\\\"\",\"predictionType\":\"PredictiveRightsizing\",\"category\":\"HighAvailability\",\"impact\":\"Low\",\"impactedField\":\"obhdxbmtqioqjze\",\"lastUpdated\":\"2021-01-14T01:11:27Z\",\"shortDescription\":{\"problem\":\"fpownoizhwlr\",\"solution\":\"bqsoqijg\"}}}") + .toObject(PredictionResponseInner.class); + Assertions.assertEquals(PredictionType.PREDICTIVE_RIGHTSIZING, model.predictionType()); + Assertions.assertEquals(Category.HIGH_AVAILABILITY, model.category()); + Assertions.assertEquals(Impact.LOW, model.impact()); + Assertions.assertEquals("obhdxbmtqioqjze", model.impactedField()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-14T01:11:27Z"), model.lastUpdated()); + Assertions.assertEquals("fpownoizhwlr", model.shortDescription().problem()); + Assertions.assertEquals("bqsoqijg", model.shortDescription().solution()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionResponsePropertiesTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionResponsePropertiesTests.java new file mode 100644 index 0000000000000..c4b87e9b3e36d --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/PredictionResponsePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.PredictionResponseProperties; +import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.PredictionType; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class PredictionResponsePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PredictionResponseProperties model = BinaryData.fromString( + "{\"extendedProperties\":\"\\\"datambpazlobcufpdzn\\\"\",\"predictionType\":\"PredictiveRightsizing\",\"category\":\"Cost\",\"impact\":\"High\",\"impactedField\":\"qglhq\",\"lastUpdated\":\"2021-10-04T01:48:43Z\",\"shortDescription\":{\"problem\":\"oo\",\"solution\":\"wifsq\"}}") + .toObject(PredictionResponseProperties.class); + Assertions.assertEquals(PredictionType.PREDICTIVE_RIGHTSIZING, model.predictionType()); + Assertions.assertEquals(Category.COST, model.category()); + Assertions.assertEquals(Impact.HIGH, model.impact()); + Assertions.assertEquals("qglhq", model.impactedField()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-04T01:48:43Z"), model.lastUpdated()); + Assertions.assertEquals("oo", model.shortDescription().problem()); + Assertions.assertEquals("wifsq", model.shortDescription().solution()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadatasGetWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadatasGetWithResponseMockTests.java index 1ddaa3f2c06ac..8ca1e021cca02 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadatasGetWithResponseMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadatasGetWithResponseMockTests.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.models.MetadataEntity; @@ -22,26 +22,22 @@ public final class RecommendationMetadatasGetWithResponseMockTests { @Test public void testGetWithResponse() throws Exception { String responseStr - = "{\"id\":\"laocqxtccmg\",\"type\":\"dxyt\",\"name\":\"oyrxvwfudwpzntxh\",\"properties\":{\"displayName\":\"lrqjbhckfr\",\"dependsOn\":[\"xsbkyvpyca\",\"uzbpzkafku\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\"],\"supportedValues\":[{\"id\":\"ehhseyvjusrts\",\"displayName\":\"spkdee\"},{\"id\":\"ofmxagkvtmelmqkr\",\"displayName\":\"hvljuahaquh\"}]}}"; + = "{\"properties\":{\"displayName\":\"mfpgv\",\"dependsOn\":[\"paslthaqfxssmwu\",\"wbdsr\",\"zpdrhneu\",\"owqkdwytisi\"],\"applicableScenarios\":[\"Alerts\"],\"supportedValues\":[{\"id\":\"kpzi\",\"displayName\":\"j\"},{\"id\":\"nlfzxiavrmbz\",\"displayName\":\"okixrjqcir\"}]},\"id\":\"pfrlazsz\",\"name\":\"nwoiind\",\"type\":\"pwp\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - MetadataEntity response = manager.recommendationMetadatas() - .getWithResponse("kqujidsuyono", com.azure.core.util.Context.NONE) - .getValue(); + MetadataEntity response + = manager.recommendationMetadatas().getWithResponse("t", com.azure.core.util.Context.NONE).getValue(); - Assertions.assertEquals("laocqxtccmg", response.id()); - Assertions.assertEquals("dxyt", response.type()); - Assertions.assertEquals("oyrxvwfudwpzntxh", response.name()); - Assertions.assertEquals("lrqjbhckfr", response.displayName()); - Assertions.assertEquals("xsbkyvpyca", response.dependsOn().get(0)); + Assertions.assertEquals("mfpgv", response.displayName()); + Assertions.assertEquals("paslthaqfxssmwu", response.dependsOn().get(0)); Assertions.assertEquals(Scenario.ALERTS, response.applicableScenarios().get(0)); - Assertions.assertEquals("ehhseyvjusrts", response.supportedValues().get(0).id()); - Assertions.assertEquals("spkdee", response.supportedValues().get(0).displayName()); + Assertions.assertEquals("kpzi", response.supportedValues().get(0).id()); + Assertions.assertEquals("j", response.supportedValues().get(0).displayName()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadatasListMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadatasListMockTests.java index 4e5afe1a82620..783e0113ec0dd 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadatasListMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadatasListMockTests.java @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.models.MetadataEntity; @@ -23,25 +23,22 @@ public final class RecommendationMetadatasListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"id\":\"hmdua\",\"type\":\"exq\",\"name\":\"fadmws\",\"properties\":{\"displayName\":\"gvxp\",\"dependsOn\":[\"mzlfmisgwb\",\"b\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\",\"Alerts\",\"Alerts\"],\"supportedValues\":[{\"id\":\"liourqhak\",\"displayName\":\"hashsfwxosow\"},{\"id\":\"cugicjoox\",\"displayName\":\"ebwpucwwfvo\"},{\"id\":\"vmeueci\",\"displayName\":\"hzceuojgjrwjue\"},{\"id\":\"twm\",\"displayName\":\"ytdxwit\"}]}}]}"; + = "{\"value\":[{\"properties\":{\"displayName\":\"fbgofeljagrqmqh\",\"dependsOn\":[\"riiiojnalghfkv\",\"vsexsowuelu\"],\"applicableScenarios\":[\"Alerts\",\"Alerts\",\"Alerts\",\"Alerts\"],\"supportedValues\":[{\"id\":\"mzkwpjg\",\"displayName\":\"spughftqsxhq\"},{\"id\":\"j\",\"displayName\":\"kndxdigrjgu\"}]},\"id\":\"zdmsyqtfi\",\"name\":\"whbotzingamv\",\"type\":\"phoszqz\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); PagedIterable response - = manager.recommendationMetadatas().list(com.azure.core.util.Context.NONE); + = manager.recommendationMetadatas().list("ylwbtlhflsjcdhsz", com.azure.core.util.Context.NONE); - Assertions.assertEquals("hmdua", response.iterator().next().id()); - Assertions.assertEquals("exq", response.iterator().next().type()); - Assertions.assertEquals("fadmws", response.iterator().next().name()); - Assertions.assertEquals("gvxp", response.iterator().next().displayName()); - Assertions.assertEquals("mzlfmisgwb", response.iterator().next().dependsOn().get(0)); + Assertions.assertEquals("fbgofeljagrqmqh", response.iterator().next().displayName()); + Assertions.assertEquals("riiiojnalghfkv", response.iterator().next().dependsOn().get(0)); Assertions.assertEquals(Scenario.ALERTS, response.iterator().next().applicableScenarios().get(0)); - Assertions.assertEquals("liourqhak", response.iterator().next().supportedValues().get(0).id()); - Assertions.assertEquals("hashsfwxosow", response.iterator().next().supportedValues().get(0).displayName()); + Assertions.assertEquals("mzkwpjg", response.iterator().next().supportedValues().get(0).id()); + Assertions.assertEquals("spughftqsxhq", response.iterator().next().supportedValues().get(0).displayName()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPatchPayloadTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPatchPayloadTests.java new file mode 100644 index 0000000000000..74426538f00a1 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPatchPayloadTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationPatchPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatePropertiesPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class RecommendationPatchPayloadTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecommendationPatchPayload model = BinaryData.fromString( + "{\"properties\":{\"recommendationStatus\":\"Completed\",\"recommendationDismissReason\":\"RiskIsAcceptable\",\"postponedUntilDateTime\":\"2021-09-10T15:31:21Z\"}}") + .toObject(RecommendationPatchPayload.class); + Assertions.assertEquals(RecommendationStatus.COMPLETED, model.properties().recommendationStatus()); + Assertions.assertEquals(RecommendationDismissReason.RISK_IS_ACCEPTABLE, + model.properties().recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-10T15:31:21Z"), + model.properties().postponedUntilDateTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecommendationPatchPayload model = new RecommendationPatchPayload().withProperties( + new RecommendationStatePropertiesPayload().withRecommendationStatus(RecommendationStatus.COMPLETED) + .withRecommendationDismissReason(RecommendationDismissReason.RISK_IS_ACCEPTABLE) + .withPostponedUntilDateTime(OffsetDateTime.parse("2021-09-10T15:31:21Z"))); + model = BinaryData.fromObject(model).toObject(RecommendationPatchPayload.class); + Assertions.assertEquals(RecommendationStatus.COMPLETED, model.properties().recommendationStatus()); + Assertions.assertEquals(RecommendationDismissReason.RISK_IS_ACCEPTABLE, + model.properties().recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-10T15:31:21Z"), + model.properties().postponedUntilDateTime()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesResourceWorkloadTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesResourceWorkloadTests.java new file mode 100644 index 0000000000000..f72f53188e2ab --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesResourceWorkloadTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.RecommendationPropertiesResourceWorkload; +import org.junit.jupiter.api.Assertions; + +public final class RecommendationPropertiesResourceWorkloadTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecommendationPropertiesResourceWorkload model + = BinaryData.fromString("{\"id\":\"dsfcpkvxodpuoz\",\"name\":\"zydagfuaxbezyiuo\"}") + .toObject(RecommendationPropertiesResourceWorkload.class); + Assertions.assertEquals("dsfcpkvxodpuoz", model.id()); + Assertions.assertEquals("zydagfuaxbezyiuo", model.name()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesReviewTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesReviewTests.java new file mode 100644 index 0000000000000..22131c18dcaf3 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesReviewTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.RecommendationPropertiesReview; +import org.junit.jupiter.api.Assertions; + +public final class RecommendationPropertiesReviewTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecommendationPropertiesReview model + = BinaryData.fromString("{\"id\":\"oaeupfhyhltrpmo\",\"name\":\"mcmatuokthfuiu\"}") + .toObject(RecommendationPropertiesReview.class); + Assertions.assertEquals("oaeupfhyhltrpmo", model.id()); + Assertions.assertEquals("mcmatuokthfuiu", model.name()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesTests.java index 21468624bac36..b053ff639260a 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesTests.java @@ -1,108 +1,59 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.util.BinaryData; import com.azure.resourcemanager.advisor.fluent.models.RecommendationProperties; import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; import com.azure.resourcemanager.advisor.models.Impact; -import com.azure.resourcemanager.advisor.models.ResourceMetadata; -import com.azure.resourcemanager.advisor.models.ShortDescription; +import com.azure.resourcemanager.advisor.models.Priority; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import com.azure.resourcemanager.advisor.models.Risk; import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; import org.junit.jupiter.api.Assertions; public final class RecommendationPropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { RecommendationProperties model = BinaryData.fromString( - "{\"category\":\"Performance\",\"impact\":\"High\",\"impactedField\":\"hqyudxorrqnbpoc\",\"impactedValue\":\"yifqrvkdvjsllrmv\",\"lastUpdated\":\"2021-05-03T22:43:17Z\",\"metadata\":{\"pnpulexxbczwtru\":\"datat\",\"vsovmyokac\":\"dataiqzbq\"},\"recommendationTypeId\":\"kwlhzdo\",\"shortDescription\":{\"problem\":\"jmflbvvnch\",\"solution\":\"cciw\"},\"suppressionIds\":[\"629ff93a-4933-480d-a93a-b8efedcc1ef2\"],\"extendedProperties\":{\"jiwkuofoskghsau\":\"khrs\"},\"resourceMetadata\":{\"resourceId\":\"jmvxie\",\"source\":\"ugidyjrr\",\"action\":{\"e\":\"dataaos\"},\"singular\":\"sonpclhocohs\",\"plural\":\"ev\"},\"description\":\"ggzfbu\",\"label\":\"mvfaxkffeiith\",\"learnMoreLink\":\"m\",\"potentialBenefits\":\"yvshxmz\",\"actions\":[{\"xxjnspydptk\":\"dataoggigrxwburv\",\"iukbldngkpoci\":\"dataenkouknvudw\",\"npiucgygevqznty\":\"dataazyxoegukg\",\"dpydn\":\"datamrbpizcdrqj\"},{\"cwif\":\"datahxdeoejz\",\"ishc\":\"datajttgzf\",\"eyeam\":\"datakhaj\",\"agalpbuxwgipwhon\":\"datap\"},{\"kix\":\"datakgshwa\",\"eputtmrywnuzoqf\":\"databin\"}],\"remediation\":{\"sicohoqqnwvlry\":\"dataqzrnkcqvyxlwhz\",\"konocu\":\"datavwhheunmmqhgyx\",\"zf\":\"dataoklyaxuconuq\",\"vjektcxsenh\":\"databeypewrmjmw\"},\"exposedMetadataProperties\":{\"frzpwvlqdqgb\":\"datas\",\"fcivfsnkym\":\"dataqylihkaetckt\",\"jf\":\"datactq\",\"fuwutttxf\":\"dataebrjcxe\"}}") + "{\"category\":\"Cost\",\"control\":\"PrioritizedRecommendations\",\"impact\":\"Medium\",\"impactedField\":\"kwh\",\"impactedValue\":\"oifiyipjxsqwpgr\",\"criticalityScore\":\"znorcj\",\"criticality\":\"snb\",\"scoreChangedAt\":\"qabnmoc\",\"serviceGroupId\":\"ysh\",\"savings\":{\"providerCurrency\":\"afbljjgpbtoqcjmk\",\"billingCurrency\":\"a\",\"isDirectChannel\":true,\"resourceDeletedOn\":\"2021-07-25T21:09:54Z\",\"retail\":{\"potentialSavings\":32.1647352124851,\"potentialSavingsInBillingCurrency\":58.20265348363045,\"wastedTillDate\":17.32046243114358,\"wastedTillDateInBillingCurrency\":8.790370504390498,\"realizedSavings\":85.05088579048405,\"realizedSavingsInBillingCurrency\":44.19727442768867},\"contracted\":{\"potentialSavings\":42.61178604549292,\"potentialSavingsInBillingCurrency\":52.30420726827526,\"wastedTillDate\":16.326877547812835,\"wastedTillDateInBillingCurrency\":20.385244844594,\"realizedSavings\":4.859295108303197,\"realizedSavingsInBillingCurrency\":3.486285099016684}},\"recommendationStatus\":\"Completed\",\"completionType\":\"rhhbcs\",\"recommendationDismissReason\":\"RiskIsAcceptable\",\"postponedUntilDateTime\":\"2021-06-09T11:27:26Z\",\"lastRefreshed\":\"2021-11-23T17:21:38Z\",\"lastUpdated\":\"2021-10-28T08:05:45Z\",\"createdTime\":\"2021-07-24T00:15:50Z\",\"metadata\":{\"onpimexgstxg\":\"\\\"dataobnbdxkqpxokaj\\\"\",\"gmaajrm\":\"\\\"datapo\\\"\",\"clwhijcoejctbz\":\"\\\"datadjwzrlov\\\"\",\"bkbfkgukdkex\":\"\\\"dataqsqsy\\\"\"},\"recommendationTypeId\":\"pofm\",\"risk\":\"None\",\"shortDescription\":{\"problem\":\"jpgd\",\"solution\":\"ocjjxhvpmouexh\"},\"suppressionId\":\"xibqeojnx\",\"extendedProperties\":{\"eic\":\"vddntwn\",\"cyddglmjthjqk\":\"twnpzaoqvuhrhcf\",\"ciwqvhk\":\"pyeicxm\",\"ghmewuam\":\"ixuigdtopbobj\"},\"resourceMetadata\":{\"resourceId\":\"rzayv\",\"source\":\"pgvdf\",\"action\":{\"efgugnxk\":\"\\\"datatkftutqxlngx\\\"\",\"hjybigehoqfbo\":\"\\\"dataxdqmidtthzrvqdra\\\"\",\"zlcuiywgqywgndrv\":\"\\\"dataskanyk\\\"\",\"ocpecfvmmco\":\"\\\"datanhzgpphrcgyn\\\"\"},\"singular\":\"sxlzevgbmqj\",\"plural\":\"bcypmi\"},\"description\":\"w\",\"label\":\"uvcc\",\"learnMoreLink\":\"nfnbacfionlebxe\",\"potentialBenefits\":\"gtzxdpn\",\"actions\":[{\"snjampmng\":\"\\\"datawxrjfeallnwsub\\\"\",\"chcbonqvpkvlrxnj\":\"\\\"datazscxaqwo\\\"\",\"enjbdlwtgrhp\":\"\\\"dataase\\\"\"}],\"remediation\":{\"zj\":\"\\\"datajumasx\\\"\"},\"exposedMetadataProperties\":{\"ualhbxxhejj\":\"\\\"datae\\\"\"},\"trackedProperties\":{\"priority\":\"High\"},\"review\":{\"id\":\"gwdslfhotwm\",\"name\":\"npwlbjnpg\"},\"resourceWorkload\":{\"id\":\"tadehxnltyfsopp\",\"name\":\"uesnzwdejbavo\"},\"sourceSystem\":\"zdmohctbqvu\",\"notes\":\"xdn\"}") .toObject(RecommendationProperties.class); - Assertions.assertEquals(Category.PERFORMANCE, model.category()); - Assertions.assertEquals(Impact.HIGH, model.impact()); - Assertions.assertEquals("hqyudxorrqnbpoc", model.impactedField()); - Assertions.assertEquals("yifqrvkdvjsllrmv", model.impactedValue()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-03T22:43:17Z"), model.lastUpdated()); - Assertions.assertEquals("kwlhzdo", model.recommendationTypeId()); - Assertions.assertEquals("jmflbvvnch", model.shortDescription().problem()); - Assertions.assertEquals("cciw", model.shortDescription().solution()); - Assertions.assertEquals(UUID.fromString("629ff93a-4933-480d-a93a-b8efedcc1ef2"), model.suppressionIds().get(0)); - Assertions.assertEquals("khrs", model.extendedProperties().get("jiwkuofoskghsau")); - Assertions.assertEquals("jmvxie", model.resourceMetadata().resourceId()); - Assertions.assertEquals("ugidyjrr", model.resourceMetadata().source()); - Assertions.assertEquals("sonpclhocohs", model.resourceMetadata().singular()); - Assertions.assertEquals("ev", model.resourceMetadata().plural()); - Assertions.assertEquals("ggzfbu", model.description()); - Assertions.assertEquals("mvfaxkffeiith", model.label()); - Assertions.assertEquals("m", model.learnMoreLink()); - Assertions.assertEquals("yvshxmz", model.potentialBenefits()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecommendationProperties model = new RecommendationProperties().withCategory(Category.PERFORMANCE) - .withImpact(Impact.HIGH) - .withImpactedField("hqyudxorrqnbpoc") - .withImpactedValue("yifqrvkdvjsllrmv") - .withLastUpdated(OffsetDateTime.parse("2021-05-03T22:43:17Z")) - .withMetadata(mapOf("pnpulexxbczwtru", "datat", "vsovmyokac", "dataiqzbq")) - .withRecommendationTypeId("kwlhzdo") - .withShortDescription(new ShortDescription().withProblem("jmflbvvnch").withSolution("cciw")) - .withSuppressionIds(Arrays.asList(UUID.fromString("629ff93a-4933-480d-a93a-b8efedcc1ef2"))) - .withExtendedProperties(mapOf("jiwkuofoskghsau", "khrs")) - .withResourceMetadata(new ResourceMetadata().withResourceId("jmvxie") - .withSource("ugidyjrr") - .withAction(mapOf("e", "dataaos")) - .withSingular("sonpclhocohs") - .withPlural("ev")) - .withDescription("ggzfbu") - .withLabel("mvfaxkffeiith") - .withLearnMoreLink("m") - .withPotentialBenefits("yvshxmz") - .withActions(Arrays.asList( - mapOf("xxjnspydptk", "dataoggigrxwburv", "iukbldngkpoci", "dataenkouknvudw", "npiucgygevqznty", - "dataazyxoegukg", "dpydn", "datamrbpizcdrqj"), - mapOf("cwif", "datahxdeoejz", "ishc", "datajttgzf", "eyeam", "datakhaj", "agalpbuxwgipwhon", "datap"), - mapOf("kix", "datakgshwa", "eputtmrywnuzoqf", "databin"))) - .withRemediation(mapOf("sicohoqqnwvlry", "dataqzrnkcqvyxlwhz", "konocu", "datavwhheunmmqhgyx", "zf", - "dataoklyaxuconuq", "vjektcxsenh", "databeypewrmjmw")) - .withExposedMetadataProperties(mapOf("frzpwvlqdqgb", "datas", "fcivfsnkym", "dataqylihkaetckt", "jf", - "datactq", "fuwutttxf", "dataebrjcxe")); - model = BinaryData.fromObject(model).toObject(RecommendationProperties.class); - Assertions.assertEquals(Category.PERFORMANCE, model.category()); - Assertions.assertEquals(Impact.HIGH, model.impact()); - Assertions.assertEquals("hqyudxorrqnbpoc", model.impactedField()); - Assertions.assertEquals("yifqrvkdvjsllrmv", model.impactedValue()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-03T22:43:17Z"), model.lastUpdated()); - Assertions.assertEquals("kwlhzdo", model.recommendationTypeId()); - Assertions.assertEquals("jmflbvvnch", model.shortDescription().problem()); - Assertions.assertEquals("cciw", model.shortDescription().solution()); - Assertions.assertEquals(UUID.fromString("629ff93a-4933-480d-a93a-b8efedcc1ef2"), model.suppressionIds().get(0)); - Assertions.assertEquals("khrs", model.extendedProperties().get("jiwkuofoskghsau")); - Assertions.assertEquals("jmvxie", model.resourceMetadata().resourceId()); - Assertions.assertEquals("ugidyjrr", model.resourceMetadata().source()); - Assertions.assertEquals("sonpclhocohs", model.resourceMetadata().singular()); - Assertions.assertEquals("ev", model.resourceMetadata().plural()); - Assertions.assertEquals("ggzfbu", model.description()); - Assertions.assertEquals("mvfaxkffeiith", model.label()); - Assertions.assertEquals("m", model.learnMoreLink()); - Assertions.assertEquals("yvshxmz", model.potentialBenefits()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; + Assertions.assertEquals(Category.COST, model.category()); + Assertions.assertEquals(Control.PRIORITIZED_RECOMMENDATIONS, model.control()); + Assertions.assertEquals(Impact.MEDIUM, model.impact()); + Assertions.assertEquals("kwh", model.impactedField()); + Assertions.assertEquals("oifiyipjxsqwpgr", model.impactedValue()); + Assertions.assertEquals(RecommendationStatus.COMPLETED, model.recommendationStatus()); + Assertions.assertEquals("rhhbcs", model.completionType()); + Assertions.assertEquals(RecommendationDismissReason.RISK_IS_ACCEPTABLE, model.recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-09T11:27:26Z"), model.postponedUntilDateTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-23T17:21:38Z"), model.lastRefreshed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-28T08:05:45Z"), model.lastUpdated()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-24T00:15:50Z"), model.createdTime()); + Assertions.assertEquals("pofm", model.recommendationTypeId()); + Assertions.assertEquals(Risk.NONE, model.risk()); + Assertions.assertEquals("jpgd", model.shortDescription().problem()); + Assertions.assertEquals("ocjjxhvpmouexh", model.shortDescription().solution()); + Assertions.assertEquals("xibqeojnx", model.suppressionId()); + Assertions.assertEquals("vddntwn", model.extendedProperties().get("eic")); + Assertions.assertEquals("rzayv", model.resourceMetadata().resourceId()); + Assertions.assertEquals("pgvdf", model.resourceMetadata().source()); + Assertions.assertEquals("sxlzevgbmqj", model.resourceMetadata().singular()); + Assertions.assertEquals("bcypmi", model.resourceMetadata().plural()); + Assertions.assertEquals("w", model.description()); + Assertions.assertEquals("uvcc", model.label()); + Assertions.assertEquals("nfnbacfionlebxe", model.learnMoreLink()); + Assertions.assertEquals("gtzxdpn", model.potentialBenefits()); + Assertions.assertEquals(Priority.HIGH, model.trackedProperties().priority()); + Assertions.assertEquals("gwdslfhotwm", model.review().id()); + Assertions.assertEquals("npwlbjnpg", model.review().name()); + Assertions.assertEquals("tadehxnltyfsopp", model.resourceWorkload().id()); + Assertions.assertEquals("uesnzwdejbavo", model.resourceWorkload().name()); + Assertions.assertEquals("zdmohctbqvu", model.sourceSystem()); + Assertions.assertEquals("xdn", model.notes()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationStatePropertiesPayloadTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationStatePropertiesPayloadTests.java new file mode 100644 index 0000000000000..9d3c65b0307c5 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationStatePropertiesPayloadTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationStatePropertiesPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class RecommendationStatePropertiesPayloadTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecommendationStatePropertiesPayload model = BinaryData.fromString( + "{\"recommendationStatus\":\"Dismissed\",\"recommendationDismissReason\":\"IncompatibleWithTheCurrentConfiguration\",\"postponedUntilDateTime\":\"2021-04-17T05:25:38Z\"}") + .toObject(RecommendationStatePropertiesPayload.class); + Assertions.assertEquals(RecommendationStatus.DISMISSED, model.recommendationStatus()); + Assertions.assertEquals(RecommendationDismissReason.INCOMPATIBLE_WITH_THE_CURRENT_CONFIGURATION, + model.recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-17T05:25:38Z"), model.postponedUntilDateTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecommendationStatePropertiesPayload model + = new RecommendationStatePropertiesPayload().withRecommendationStatus(RecommendationStatus.DISMISSED) + .withRecommendationDismissReason( + RecommendationDismissReason.INCOMPATIBLE_WITH_THE_CURRENT_CONFIGURATION) + .withPostponedUntilDateTime(OffsetDateTime.parse("2021-04-17T05:25:38Z")); + model = BinaryData.fromObject(model).toObject(RecommendationStatePropertiesPayload.class); + Assertions.assertEquals(RecommendationStatus.DISMISSED, model.recommendationStatus()); + Assertions.assertEquals(RecommendationDismissReason.INCOMPATIBLE_WITH_THE_CURRENT_CONFIGURATION, + model.recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-17T05:25:38Z"), model.postponedUntilDateTime()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGenerateWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGenerateWithResponseMockTests.java index 09ebd14fccec0..86eab130afd7f 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGenerateWithResponseMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGenerateWithResponseMockTests.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import java.nio.charset.StandardCharsets; @@ -25,7 +25,7 @@ public void testGenerateWithResponse() throws Exception { AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); manager.recommendations().generateWithResponse(com.azure.core.util.Context.NONE); diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetByServiceGroupWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetByServiceGroupWithResponseMockTests.java new file mode 100644 index 0000000000000..4fc9dbbf3f3e0 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetByServiceGroupWithResponseMockTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; +import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.Priority; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import com.azure.resourcemanager.advisor.models.ResourceRecommendationBase; +import com.azure.resourcemanager.advisor.models.Risk; +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 RecommendationsGetByServiceGroupWithResponseMockTests { + @Test + public void testGetByServiceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"category\":\"HighAvailability\",\"control\":\"BusinessContinuity\",\"impact\":\"Medium\",\"impactedField\":\"fewetwlyxgncx\",\"impactedValue\":\"xhdjhl\",\"criticalityScore\":\"mbcxfhbcp\",\"criticality\":\"xvxcjzhq\",\"scoreChangedAt\":\"xfpxtgqscja\",\"serviceGroupId\":\"t\",\"savings\":{\"providerCurrency\":\"dqazkmtgguwpijra\",\"billingCurrency\":\"ivmmghfcfiwrxgk\",\"isDirectChannel\":true,\"resourceDeletedOn\":\"2021-03-10T19:40:09Z\",\"retail\":{\"potentialSavings\":68.88861707633018,\"potentialSavingsInBillingCurrency\":25.93855059926986,\"wastedTillDate\":86.5191521610352,\"wastedTillDateInBillingCurrency\":51.855727808289544,\"realizedSavings\":64.71398267904833,\"realizedSavingsInBillingCurrency\":39.463931406562345},\"contracted\":{\"potentialSavings\":68.77050040063554,\"potentialSavingsInBillingCurrency\":11.78862079436993,\"wastedTillDate\":38.56489430783881,\"wastedTillDateInBillingCurrency\":39.98362130765207,\"realizedSavings\":84.58758846646455,\"realizedSavingsInBillingCurrency\":7.050154666136632}},\"recommendationStatus\":\"New\",\"completionType\":\"cqusr\",\"recommendationDismissReason\":\"TooComplexOrImpracticalToImplement\",\"postponedUntilDateTime\":\"2021-10-16T19:18:21Z\",\"lastRefreshed\":\"2021-02-14T01:46:34Z\",\"lastUpdated\":\"2021-05-08T18:57:37Z\",\"createdTime\":\"2021-06-25T18:09:28Z\",\"metadata\":{\"zhyrmewipmve\":\"\\\"datalduycv\\\"\",\"etw\":\"\\\"datadxukuqgsjjxundxg\\\"\"},\"recommendationTypeId\":\"hzjhf\",\"risk\":\"Error\",\"shortDescription\":{\"problem\":\"muvgp\",\"solution\":\"neqsxvmh\"},\"suppressionId\":\"uzjyihsasbhudypo\",\"extendedProperties\":{\"oobrlttyms\":\"emslynsqyrp\",\"nfwqzdzgtilaxhn\":\"nygq\"},\"resourceMetadata\":{\"resourceId\":\"lyvijouwiv\",\"source\":\"oyzunbixxr\",\"action\":{\"vtsoxf\":\"\\\"datavcpwpgclrc\\\"\",\"m\":\"\\\"datakenx\\\"\",\"ao\":\"\\\"datayefrpmpdnqqska\\\"\"},\"singular\":\"mmbnpqfrtql\",\"plural\":\"megni\"},\"description\":\"vkxlz\",\"label\":\"drf\",\"learnMoreLink\":\"cealzxwh\",\"potentialBenefits\":\"nsymoyqhlwigd\",\"actions\":[{\"wasqvdaeyyg\":\"\\\"databxgomfaj\\\"\",\"zkgimsid\":\"\\\"dataxakjsqzhzb\\\"\"},{\"skgfmocwahpq\":\"\\\"datasicddyvv\\\"\"},{\"akz\":\"\\\"datatjeaahhvjhh\\\"\",\"xvxevblbjednljla\":\"\\\"databbjjidjksyxk\\\"\"}],\"remediation\":{\"nsmjbnkppxynen\":\"\\\"dataaulx\\\"\",\"ffeycx\":\"\\\"datasvxeizzgwklnsr\\\"\",\"ymerteeammxq\":\"\\\"dataktp\\\"\"},\"exposedMetadataProperties\":{\"a\":\"\\\"datakkzddrtkgdojbmx\\\"\"},\"trackedProperties\":{\"priority\":\"Low\"},\"review\":{\"id\":\"esvecuijpx\",\"name\":\"s\"},\"resourceWorkload\":{\"id\":\"rtujwsawddjibab\",\"name\":\"ititvtzeexavoxt\"},\"sourceSystem\":\"lecdmdqbw\",\"notes\":\"pqtgsfjac\"},\"id\":\"lhhxudbxvodhtnsi\",\"name\":\"ud\",\"type\":\"z\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ResourceRecommendationBase response = manager.recommendations() + .getByServiceGroupWithResponse("hwwn", "jhlfzswpchwahf", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(Category.HIGH_AVAILABILITY, response.category()); + Assertions.assertEquals(Control.BUSINESS_CONTINUITY, response.control()); + Assertions.assertEquals(Impact.MEDIUM, response.impact()); + Assertions.assertEquals("fewetwlyxgncx", response.impactedField()); + Assertions.assertEquals("xhdjhl", response.impactedValue()); + Assertions.assertEquals(RecommendationStatus.NEW, response.recommendationStatus()); + Assertions.assertEquals("cqusr", response.completionType()); + Assertions.assertEquals(RecommendationDismissReason.TOO_COMPLEX_OR_IMPRACTICAL_TO_IMPLEMENT, + response.recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-16T19:18:21Z"), response.postponedUntilDateTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-14T01:46:34Z"), response.lastRefreshed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-08T18:57:37Z"), response.lastUpdated()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-25T18:09:28Z"), response.createdTime()); + Assertions.assertEquals("hzjhf", response.recommendationTypeId()); + Assertions.assertEquals(Risk.ERROR, response.risk()); + Assertions.assertEquals("muvgp", response.shortDescription().problem()); + Assertions.assertEquals("neqsxvmh", response.shortDescription().solution()); + Assertions.assertEquals("uzjyihsasbhudypo", response.suppressionId()); + Assertions.assertEquals("emslynsqyrp", response.extendedProperties().get("oobrlttyms")); + Assertions.assertEquals("lyvijouwiv", response.resourceMetadata().resourceId()); + Assertions.assertEquals("oyzunbixxr", response.resourceMetadata().source()); + Assertions.assertEquals("mmbnpqfrtql", response.resourceMetadata().singular()); + Assertions.assertEquals("megni", response.resourceMetadata().plural()); + Assertions.assertEquals("vkxlz", response.description()); + Assertions.assertEquals("drf", response.label()); + Assertions.assertEquals("cealzxwh", response.learnMoreLink()); + Assertions.assertEquals("nsymoyqhlwigd", response.potentialBenefits()); + Assertions.assertEquals(Priority.LOW, response.trackedProperties().priority()); + Assertions.assertEquals("esvecuijpx", response.review().id()); + Assertions.assertEquals("s", response.review().name()); + Assertions.assertEquals("rtujwsawddjibab", response.resourceWorkload().id()); + Assertions.assertEquals("ititvtzeexavoxt", response.resourceWorkload().name()); + Assertions.assertEquals("lecdmdqbw", response.sourceSystem()); + Assertions.assertEquals("pqtgsfjac", response.notes()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetGenerateStatusWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetGenerateStatusWithResponseMockTests.java index a9002b41751e8..f47b817c9979c 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetGenerateStatusWithResponseMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetGenerateStatusWithResponseMockTests.java @@ -1,18 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; -import java.util.UUID; import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; @@ -26,11 +25,9 @@ public void testGetGenerateStatusWithResponse() throws Exception { AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - manager.recommendations() - .getGenerateStatusWithResponse(UUID.fromString("a9ba72b0-f0f2-46b4-9588-f762cd2a66f2"), - com.azure.core.util.Context.NONE); + manager.recommendations().getGenerateStatusWithResponse("cu", com.azure.core.util.Context.NONE); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetWithResponseMockTests.java index 99cbcbde6bf45..cb70cbe38941c 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetWithResponseMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetWithResponseMockTests.java @@ -1,21 +1,25 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.Priority; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; import com.azure.resourcemanager.advisor.models.ResourceRecommendationBase; +import com.azure.resourcemanager.advisor.models.Risk; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; -import java.util.UUID; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; @@ -24,37 +28,52 @@ public final class RecommendationsGetWithResponseMockTests { @Test public void testGetWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"category\":\"HighAvailability\",\"impact\":\"High\",\"impactedField\":\"vfbtkuwh\",\"impactedValue\":\"hykojoxafnndlpic\",\"lastUpdated\":\"2021-09-25T08:27:56Z\",\"metadata\":{\"pwdreqnovvqf\":\"datakcdyhbpk\",\"syrsndsytgadgvra\":\"datavljxywsu\",\"uu\":\"dataaeneqnzarrwl\",\"e\":\"datajfqka\"},\"recommendationTypeId\":\"ipfpubji\",\"shortDescription\":{\"problem\":\"iftohqkvpu\",\"solution\":\"sgplsakn\"},\"suppressionIds\":[\"eb78d712-5a46-406f-97ab-fbb0a30f4664\",\"41bc6117-3982-4558-a90d-8b3f7d91eff3\",\"66c53eb1-c714-44b9-b719-94e354512334\"],\"extendedProperties\":{\"jphuopxodlqi\":\"n\"},\"resourceMetadata\":{\"resourceId\":\"orzihle\",\"source\":\"jswsrmslyz\",\"action\":{\"iysui\":\"databchckqqzqio\",\"rwyhqmibzyhwitsm\":\"datazynkedya\",\"pcdpumnz\":\"datapyy\",\"abikns\":\"datamwzn\"},\"singular\":\"gj\",\"plural\":\"bldtlww\"},\"description\":\"kdmtncvokotll\",\"label\":\"yhgsy\",\"learnMoreLink\":\"ogjltdtbnnhad\",\"potentialBenefits\":\"crkvcikhnv\",\"actions\":[{\"wggxkallat\":\"datagxqquezik\",\"cjzkzivgvvcna\":\"dataelwuipi\",\"drd\":\"datarhyrnxxmueed\"}],\"remediation\":{\"tdaaygdvwvg\":\"datakwqqtchealmf\",\"epxgyqagvr\":\"dataiohgwxrtfud\",\"imfnjhfjx\":\"datamnpkukghimdblxg\"},\"exposedMetadataProperties\":{\"foqreyfkzik\":\"datazk\",\"wczelpci\":\"datajawneaiv\",\"abfatkl\":\"dataelsfeaen\"}},\"id\":\"dxbjhwuaanozj\",\"name\":\"sphyoulpjrvxa\",\"type\":\"l\"}"; + = "{\"properties\":{\"category\":\"Performance\",\"control\":\"HighAvailability\",\"impact\":\"High\",\"impactedField\":\"mtnvyq\",\"impactedValue\":\"tkzwpcnpwzc\",\"criticalityScore\":\"esgvvsccyaj\",\"criticality\":\"qfhwyg\",\"scoreChangedAt\":\"vdnkfxusem\",\"serviceGroupId\":\"zrmuhapfcqdps\",\"savings\":{\"providerCurrency\":\"vpsvuoymgcce\",\"billingCurrency\":\"ezrypql\",\"isDirectChannel\":true,\"resourceDeletedOn\":\"2021-08-31T23:42:04Z\",\"retail\":{\"potentialSavings\":59.936998389035544,\"potentialSavingsInBillingCurrency\":19.447211368070594,\"wastedTillDate\":8.367583059550554,\"wastedTillDateInBillingCurrency\":11.727050516540437,\"realizedSavings\":82.42264570224219,\"realizedSavingsInBillingCurrency\":74.24321044368813},\"contracted\":{\"potentialSavings\":19.047442488516676,\"potentialSavingsInBillingCurrency\":11.420904065925775,\"wastedTillDate\":30.71008913912464,\"wastedTillDateInBillingCurrency\":78.35667876907348,\"realizedSavings\":13.078550576281744,\"realizedSavingsInBillingCurrency\":41.38419941478164}},\"recommendationStatus\":\"Completed\",\"completionType\":\"p\",\"recommendationDismissReason\":\"TooComplexOrImpracticalToImplement\",\"postponedUntilDateTime\":\"2021-11-18T15:26:35Z\",\"lastRefreshed\":\"2021-08-06T20:29:45Z\",\"lastUpdated\":\"2021-05-12T04:10:49Z\",\"createdTime\":\"2021-09-07T14:23:49Z\",\"metadata\":{\"dhtmdvypgikd\":\"\\\"datangwfqatm\\\"\"},\"recommendationTypeId\":\"zywkb\",\"risk\":\"None\",\"shortDescription\":{\"problem\":\"zh\",\"solution\":\"kj\"},\"suppressionId\":\"rvqqaatj\",\"extendedProperties\":{\"fiibfggjioolvr\":\"vgoup\"},\"resourceMetadata\":{\"resourceId\":\"v\",\"source\":\"k\",\"action\":{\"vblm\":\"\\\"dataqwjygvja\\\"\",\"byrqufeg\":\"\\\"datavkzuhbxvvyhgso\\\"\",\"mctlpdngitv\":\"\\\"datauvwzfbnh\\\"\",\"grhbpn\":\"\\\"databmhrixkwmyijejv\\\"\"},\"singular\":\"xexccbdreaxhcexd\",\"plural\":\"vqahqkghtpwi\"},\"description\":\"hyjsvfycx\",\"label\":\"fvoow\",\"learnMoreLink\":\"vmtgjqppy\",\"potentialBenefits\":\"tronzmyhgfi\",\"actions\":[{\"sgumhjglikkxwsl\":\"\\\"datakmcwaekrrjreafx\\\"\",\"tgp\":\"\\\"datalbqpvuzlmvfelf\\\"\",\"xeznoi\":\"\\\"datacrpw\\\"\",\"pn\":\"\\\"databrnjwmw\\\"\"}],\"remediation\":{\"gfhsxttaugzxn\":\"\\\"datazejjoqk\\\"\"},\"exposedMetadataProperties\":{\"kdmkqjjlwuenvrkp\":\"\\\"datazpxdt\\\"\",\"ibreb\":\"\\\"dataou\\\"\",\"kixqtnqtt\":\"\\\"dataaays\\\"\",\"pqqmted\":\"\\\"datazlwfffiakp\\\"\"},\"trackedProperties\":{\"priority\":\"High\"},\"review\":{\"id\":\"hyeozphvwau\",\"name\":\"ncyg\"},\"resourceWorkload\":{\"id\":\"vipmdscwxqupevzh\",\"name\":\"totxhojujb\"},\"sourceSystem\":\"elmcuvhixbjxyfw\",\"notes\":\"lrcoolsttpki\"},\"id\":\"kbnujr\",\"name\":\"wvtylbfpncurdo\",\"type\":\"wiithtywub\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); ResourceRecommendationBase response = manager.recommendations() - .getWithResponse("obyu", "erpqlpqwcciuqg", com.azure.core.util.Context.NONE) + .getWithResponse("dphqamv", "kfwynw", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals(Category.HIGH_AVAILABILITY, response.category()); + Assertions.assertEquals(Category.PERFORMANCE, response.category()); + Assertions.assertEquals(Control.HIGH_AVAILABILITY, response.control()); Assertions.assertEquals(Impact.HIGH, response.impact()); - Assertions.assertEquals("vfbtkuwh", response.impactedField()); - Assertions.assertEquals("hykojoxafnndlpic", response.impactedValue()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-25T08:27:56Z"), response.lastUpdated()); - Assertions.assertEquals("ipfpubji", response.recommendationTypeId()); - Assertions.assertEquals("iftohqkvpu", response.shortDescription().problem()); - Assertions.assertEquals("sgplsakn", response.shortDescription().solution()); - Assertions.assertEquals(UUID.fromString("eb78d712-5a46-406f-97ab-fbb0a30f4664"), - response.suppressionIds().get(0)); - Assertions.assertEquals("n", response.extendedProperties().get("jphuopxodlqi")); - Assertions.assertEquals("orzihle", response.resourceMetadata().resourceId()); - Assertions.assertEquals("jswsrmslyz", response.resourceMetadata().source()); - Assertions.assertEquals("gj", response.resourceMetadata().singular()); - Assertions.assertEquals("bldtlww", response.resourceMetadata().plural()); - Assertions.assertEquals("kdmtncvokotll", response.description()); - Assertions.assertEquals("yhgsy", response.label()); - Assertions.assertEquals("ogjltdtbnnhad", response.learnMoreLink()); - Assertions.assertEquals("crkvcikhnv", response.potentialBenefits()); + Assertions.assertEquals("mtnvyq", response.impactedField()); + Assertions.assertEquals("tkzwpcnpwzc", response.impactedValue()); + Assertions.assertEquals(RecommendationStatus.COMPLETED, response.recommendationStatus()); + Assertions.assertEquals("p", response.completionType()); + Assertions.assertEquals(RecommendationDismissReason.TOO_COMPLEX_OR_IMPRACTICAL_TO_IMPLEMENT, + response.recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-18T15:26:35Z"), response.postponedUntilDateTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-06T20:29:45Z"), response.lastRefreshed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-12T04:10:49Z"), response.lastUpdated()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-07T14:23:49Z"), response.createdTime()); + Assertions.assertEquals("zywkb", response.recommendationTypeId()); + Assertions.assertEquals(Risk.NONE, response.risk()); + Assertions.assertEquals("zh", response.shortDescription().problem()); + Assertions.assertEquals("kj", response.shortDescription().solution()); + Assertions.assertEquals("rvqqaatj", response.suppressionId()); + Assertions.assertEquals("vgoup", response.extendedProperties().get("fiibfggjioolvr")); + Assertions.assertEquals("v", response.resourceMetadata().resourceId()); + Assertions.assertEquals("k", response.resourceMetadata().source()); + Assertions.assertEquals("xexccbdreaxhcexd", response.resourceMetadata().singular()); + Assertions.assertEquals("vqahqkghtpwi", response.resourceMetadata().plural()); + Assertions.assertEquals("hyjsvfycx", response.description()); + Assertions.assertEquals("fvoow", response.label()); + Assertions.assertEquals("vmtgjqppy", response.learnMoreLink()); + Assertions.assertEquals("tronzmyhgfi", response.potentialBenefits()); + Assertions.assertEquals(Priority.HIGH, response.trackedProperties().priority()); + Assertions.assertEquals("hyeozphvwau", response.review().id()); + Assertions.assertEquals("ncyg", response.review().name()); + Assertions.assertEquals("vipmdscwxqupevzh", response.resourceWorkload().id()); + Assertions.assertEquals("totxhojujb", response.resourceWorkload().name()); + Assertions.assertEquals("elmcuvhixbjxyfw", response.sourceSystem()); + Assertions.assertEquals("lrcoolsttpki", response.notes()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByServiceGroupMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByServiceGroupMockTests.java new file mode 100644 index 0000000000000..db9eed8868514 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByServiceGroupMockTests.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.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; +import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.Priority; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationListMode; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import com.azure.resourcemanager.advisor.models.ResourceRecommendationBase; +import com.azure.resourcemanager.advisor.models.Risk; +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 RecommendationsListByServiceGroupMockTests { + @Test + public void testListByServiceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"category\":\"Cost\",\"control\":\"BusinessContinuity\",\"impact\":\"High\",\"impactedField\":\"cli\",\"impactedValue\":\"zvhxnk\",\"criticalityScore\":\"tkubotppn\",\"criticality\":\"xz\",\"scoreChangedAt\":\"ihfrbbcevqa\",\"serviceGroupId\":\"ltd\",\"savings\":{\"providerCurrency\":\"kqo\",\"billingCurrency\":\"ykvgtrdcnifmz\",\"isDirectChannel\":false,\"resourceDeletedOn\":\"2021-05-29T05:05:42Z\",\"retail\":{\"potentialSavings\":89.07292900639816,\"potentialSavingsInBillingCurrency\":1.0285742052115188,\"wastedTillDate\":66.71939467679188,\"wastedTillDateInBillingCurrency\":90.74731057376593,\"realizedSavings\":17.63428570455211,\"realizedSavingsInBillingCurrency\":76.91283224014676},\"contracted\":{\"potentialSavings\":5.3478076264721786,\"potentialSavingsInBillingCurrency\":62.22934051132256,\"wastedTillDate\":49.48415215022565,\"wastedTillDateInBillingCurrency\":84.62879003789058,\"realizedSavings\":52.6383746788497,\"realizedSavingsInBillingCurrency\":78.45603352868751}},\"recommendationStatus\":\"New\",\"completionType\":\"r\",\"recommendationDismissReason\":\"Other\",\"postponedUntilDateTime\":\"2021-10-10T05:55:50Z\",\"lastRefreshed\":\"2021-10-24T00:53:01Z\",\"lastUpdated\":\"2021-10-26T21:27:37Z\",\"createdTime\":\"2021-03-21T22:40:21Z\",\"metadata\":{\"bzydvfvfcj\":\"\\\"datagkmoyxcdyuibhmfd\\\"\"},\"recommendationTypeId\":\"eoisrvhmgor\",\"risk\":\"Warning\",\"shortDescription\":{\"problem\":\"scvwmzhwplef\",\"solution\":\"vxilcbt\"},\"suppressionId\":\"hnze\",\"extendedProperties\":{\"zqlqhyc\":\"tjj\",\"mieknlraria\":\"vodggxdbee\",\"ylyrfgiagtco\":\"wiuagydwqf\",\"zldmozuxy\":\"ocqwogfnzjvus\"},\"resourceMetadata\":{\"resourceId\":\"btkadpysownbtgkb\",\"source\":\"rj\",\"action\":{\"foj\":\"\\\"dataojcmisofieyp\\\"\"},\"singular\":\"dh\",\"plural\":\"plcplcwkhi\"},\"description\":\"hlhzdsqtzbsrgno\",\"label\":\"jhf\",\"learnMoreLink\":\"vecactx\",\"potentialBenefits\":\"oteyowc\",\"actions\":[{\"wifzmp\":\"\\\"datavekqvgqo\\\"\",\"cvhrfsp\":\"\\\"datawyivqikf\\\"\",\"kvyklxubyjaffmm\":\"\\\"datauagrttikteusqc\\\"\"},{\"lmetttwgdslqxi\":\"\\\"datalcqcuubgqibrt\\\"\"},{\"pxiutc\":\"\\\"datarmooizqse\\\"\",\"joxslhvnhla\":\"\\\"dataapzhyrpetoge\\\"\"}],\"remediation\":{\"zjcjbtr\":\"\\\"datank\\\"\"},\"exposedMetadataProperties\":{\"brxjjsto\":\"\\\"datahvv\\\"\",\"tmo\":\"\\\"databeitpkx\\\"\"},\"trackedProperties\":{\"priority\":\"Informational\"},\"review\":{\"id\":\"idgfc\",\"name\":\"mpimaqxzhemjyh\"},\"resourceWorkload\":{\"id\":\"jswtwkozzwc\",\"name\":\"kb\"},\"sourceSystem\":\"pfajnjwltlwtjj\",\"notes\":\"ktalhsnvkcdmxz\"},\"id\":\"oaimlnw\",\"name\":\"aaomylweazu\",\"type\":\"cse\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.recommendations() + .listByServiceGroup("ekrsgs", "b", RecommendationListMode.ALL, 1153864546, "zq", + com.azure.core.util.Context.NONE); + + Assertions.assertEquals(Category.COST, response.iterator().next().category()); + Assertions.assertEquals(Control.BUSINESS_CONTINUITY, response.iterator().next().control()); + Assertions.assertEquals(Impact.HIGH, response.iterator().next().impact()); + Assertions.assertEquals("cli", response.iterator().next().impactedField()); + Assertions.assertEquals("zvhxnk", response.iterator().next().impactedValue()); + Assertions.assertEquals(RecommendationStatus.NEW, response.iterator().next().recommendationStatus()); + Assertions.assertEquals("r", response.iterator().next().completionType()); + Assertions.assertEquals(RecommendationDismissReason.OTHER, + response.iterator().next().recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-10T05:55:50Z"), + response.iterator().next().postponedUntilDateTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-24T00:53:01Z"), + response.iterator().next().lastRefreshed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-26T21:27:37Z"), response.iterator().next().lastUpdated()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-21T22:40:21Z"), response.iterator().next().createdTime()); + Assertions.assertEquals("eoisrvhmgor", response.iterator().next().recommendationTypeId()); + Assertions.assertEquals(Risk.WARNING, response.iterator().next().risk()); + Assertions.assertEquals("scvwmzhwplef", response.iterator().next().shortDescription().problem()); + Assertions.assertEquals("vxilcbt", response.iterator().next().shortDescription().solution()); + Assertions.assertEquals("hnze", response.iterator().next().suppressionId()); + Assertions.assertEquals("tjj", response.iterator().next().extendedProperties().get("zqlqhyc")); + Assertions.assertEquals("btkadpysownbtgkb", response.iterator().next().resourceMetadata().resourceId()); + Assertions.assertEquals("rj", response.iterator().next().resourceMetadata().source()); + Assertions.assertEquals("dh", response.iterator().next().resourceMetadata().singular()); + Assertions.assertEquals("plcplcwkhi", response.iterator().next().resourceMetadata().plural()); + Assertions.assertEquals("hlhzdsqtzbsrgno", response.iterator().next().description()); + Assertions.assertEquals("jhf", response.iterator().next().label()); + Assertions.assertEquals("vecactx", response.iterator().next().learnMoreLink()); + Assertions.assertEquals("oteyowc", response.iterator().next().potentialBenefits()); + Assertions.assertEquals(Priority.INFORMATIONAL, response.iterator().next().trackedProperties().priority()); + Assertions.assertEquals("idgfc", response.iterator().next().review().id()); + Assertions.assertEquals("mpimaqxzhemjyh", response.iterator().next().review().name()); + Assertions.assertEquals("jswtwkozzwc", response.iterator().next().resourceWorkload().id()); + Assertions.assertEquals("kb", response.iterator().next().resourceWorkload().name()); + Assertions.assertEquals("pfajnjwltlwtjj", response.iterator().next().sourceSystem()); + Assertions.assertEquals("ktalhsnvkcdmxz", response.iterator().next().notes()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByTenantMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByTenantMockTests.java new file mode 100644 index 0000000000000..dc7fe592a1f1f --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListByTenantMockTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; +import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.Priority; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import com.azure.resourcemanager.advisor.models.ResourceRecommendationBase; +import com.azure.resourcemanager.advisor.models.Risk; +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 RecommendationsListByTenantMockTests { + @Test + public void testListByTenant() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"category\":\"OperationalExcellence\",\"control\":\"ServiceUpgradeAndRetirement\",\"impact\":\"Low\",\"impactedField\":\"t\",\"impactedValue\":\"kxn\",\"criticalityScore\":\"dabg\",\"criticality\":\"udtjuewbc\",\"scoreChangedAt\":\"xuuwhcj\",\"serviceGroupId\":\"ccybvp\",\"savings\":{\"providerCurrency\":\"kkudzp\",\"billingCurrency\":\"wjplma\",\"isDirectChannel\":true,\"resourceDeletedOn\":\"2021-12-10T03:49:04Z\",\"retail\":{\"potentialSavings\":90.94723649710158,\"potentialSavingsInBillingCurrency\":89.60627162241634,\"wastedTillDate\":32.089095622638155,\"wastedTillDateInBillingCurrency\":81.52493620632941,\"realizedSavings\":15.116018796382857,\"realizedSavingsInBillingCurrency\":99.05967453984132},\"contracted\":{\"potentialSavings\":88.71489238122547,\"potentialSavingsInBillingCurrency\":87.04639346286028,\"wastedTillDate\":38.79507392936928,\"wastedTillDateInBillingCurrency\":96.88729205846948,\"realizedSavings\":52.563334418742656,\"realizedSavingsInBillingCurrency\":98.24450158358532}},\"recommendationStatus\":\"New\",\"completionType\":\"ntfpmvmemfnc\",\"recommendationDismissReason\":\"TooComplexOrImpracticalToImplement\",\"postponedUntilDateTime\":\"2021-06-14T22:03:09Z\",\"lastRefreshed\":\"2021-05-11T22:31:41Z\",\"lastUpdated\":\"2021-07-06T10:06:19Z\",\"createdTime\":\"2021-10-05T15:52:55Z\",\"metadata\":{\"rdnhfuku\":\"\\\"datahpodbzev\\\"\"},\"recommendationTypeId\":\"jcswsmys\",\"risk\":\"Warning\",\"shortDescription\":{\"problem\":\"ypfcvlerchpqbmf\",\"solution\":\"babwidfcxss\"},\"suppressionId\":\"unnoxyhk\",\"extendedProperties\":{\"oqcaaewdaomdj\":\"ddrihpf\",\"jxxkzbrmsgei\":\"l\",\"ggcula\":\"siykzkdncjdxonbz\",\"y\":\"z\"},\"resourceMetadata\":{\"resourceId\":\"ogtqxepnylbf\",\"source\":\"jlyjtlvofq\",\"action\":{\"vdwxfzwi\":\"\\\"datafcibyfmowuxrkj\\\"\",\"xjrk\":\"\\\"datavwzjbhyz\\\"\",\"eqvldspast\":\"\\\"datambtrnegvmnvu\\\"\"},\"singular\":\"kkdmfl\",\"plural\":\"stmjlxrri\"},\"description\":\"zapeewchpx\",\"label\":\"twkuziycs\",\"learnMoreLink\":\"vu\",\"potentialBenefits\":\"ztcktyh\",\"actions\":[{\"mmrqz\":\"\\\"datadcgzul\\\"\"},{\"toepryu\":\"\\\"datarjvpglydzgkrvqee\\\"\"},{\"fvaawzqa\":\"\\\"datawytpzdmovz\\\"\"}],\"remediation\":{\"cokpv\":\"\\\"datagzuriglaecxndt\\\"\",\"irclnpk\":\"\\\"datamlqtmldgxob\\\"\"},\"exposedMetadataProperties\":{\"wf\":\"\\\"datayzriykhy\\\"\",\"xqvkjlmxhomdyn\":\"\\\"datajlb\\\"\"},\"trackedProperties\":{\"priority\":\"Low\"},\"review\":{\"id\":\"umbnraauzzp\",\"name\":\"a\"},\"resourceWorkload\":{\"id\":\"dz\",\"name\":\"zwwva\"},\"sourceSystem\":\"yuvvfonkp\",\"notes\":\"qyikvy\"},\"id\":\"uyav\",\"name\":\"uwmncs\",\"type\":\"tijfybvp\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.recommendations() + .listByTenant("te", "ybfhjxa", 2142430700, "vjgsl", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(Category.OPERATIONAL_EXCELLENCE, response.iterator().next().category()); + Assertions.assertEquals(Control.SERVICE_UPGRADE_AND_RETIREMENT, response.iterator().next().control()); + Assertions.assertEquals(Impact.LOW, response.iterator().next().impact()); + Assertions.assertEquals("t", response.iterator().next().impactedField()); + Assertions.assertEquals("kxn", response.iterator().next().impactedValue()); + Assertions.assertEquals(RecommendationStatus.NEW, response.iterator().next().recommendationStatus()); + Assertions.assertEquals("ntfpmvmemfnc", response.iterator().next().completionType()); + Assertions.assertEquals(RecommendationDismissReason.TOO_COMPLEX_OR_IMPRACTICAL_TO_IMPLEMENT, + response.iterator().next().recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-14T22:03:09Z"), + response.iterator().next().postponedUntilDateTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-11T22:31:41Z"), + response.iterator().next().lastRefreshed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-06T10:06:19Z"), response.iterator().next().lastUpdated()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-05T15:52:55Z"), response.iterator().next().createdTime()); + Assertions.assertEquals("jcswsmys", response.iterator().next().recommendationTypeId()); + Assertions.assertEquals(Risk.WARNING, response.iterator().next().risk()); + Assertions.assertEquals("ypfcvlerchpqbmf", response.iterator().next().shortDescription().problem()); + Assertions.assertEquals("babwidfcxss", response.iterator().next().shortDescription().solution()); + Assertions.assertEquals("unnoxyhk", response.iterator().next().suppressionId()); + Assertions.assertEquals("ddrihpf", response.iterator().next().extendedProperties().get("oqcaaewdaomdj")); + Assertions.assertEquals("ogtqxepnylbf", response.iterator().next().resourceMetadata().resourceId()); + Assertions.assertEquals("jlyjtlvofq", response.iterator().next().resourceMetadata().source()); + Assertions.assertEquals("kkdmfl", response.iterator().next().resourceMetadata().singular()); + Assertions.assertEquals("stmjlxrri", response.iterator().next().resourceMetadata().plural()); + Assertions.assertEquals("zapeewchpx", response.iterator().next().description()); + Assertions.assertEquals("twkuziycs", response.iterator().next().label()); + Assertions.assertEquals("vu", response.iterator().next().learnMoreLink()); + Assertions.assertEquals("ztcktyh", response.iterator().next().potentialBenefits()); + Assertions.assertEquals(Priority.LOW, response.iterator().next().trackedProperties().priority()); + Assertions.assertEquals("umbnraauzzp", response.iterator().next().review().id()); + Assertions.assertEquals("a", response.iterator().next().review().name()); + Assertions.assertEquals("dz", response.iterator().next().resourceWorkload().id()); + Assertions.assertEquals("zwwva", response.iterator().next().resourceWorkload().name()); + Assertions.assertEquals("yuvvfonkp", response.iterator().next().sourceSystem()); + Assertions.assertEquals("qyikvy", response.iterator().next().notes()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListMockTests.java index 9d534dc53a45c..de07a8a351767 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListMockTests.java @@ -1,22 +1,27 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.Priority; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationListMode; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; import com.azure.resourcemanager.advisor.models.ResourceRecommendationBase; +import com.azure.resourcemanager.advisor.models.Risk; import java.nio.charset.StandardCharsets; import java.time.OffsetDateTime; -import java.util.UUID; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; @@ -25,36 +30,53 @@ public final class RecommendationsListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"category\":\"Performance\",\"impact\":\"High\",\"impactedField\":\"d\",\"impactedValue\":\"wyhzdx\",\"lastUpdated\":\"2021-03-28T04:38:02Z\",\"metadata\":{\"xzb\":\"datazmnvdfznudaod\",\"dzu\":\"datacblylpstdbhhxsr\",\"fiwjmygtdssls\":\"dataerscdntne\"},\"recommendationTypeId\":\"mweriofzpy\",\"shortDescription\":{\"problem\":\"mwabnetshhszhedp\",\"solution\":\"wiwubm\"},\"suppressionIds\":[\"88e97085-36d6-4990-aaf1-656f4898e37d\",\"62ed077e-b42c-4ac6-a505-95205c7fd1f8\",\"695bcea4-832f-4e67-9cfb-3717e056180a\",\"76bf52e6-da7c-4ca1-9811-4026cfae9d20\"],\"extendedProperties\":{\"xogaokonzmnsikv\":\"ldnkwwtppjfl\",\"qkdltfz\":\"kqze\",\"gureodkwobdag\":\"mhhv\",\"gqxndlkzgxhuripl\":\"tibqdxbxwakb\"},\"resourceMetadata\":{\"resourceId\":\"dxunkbebxmubyyn\",\"source\":\"lrb\",\"action\":{\"wlauwzizxbmpg\":\"dataoievseotgqrlltm\",\"p\":\"datajefuzmuvpbttdumo\"},\"singular\":\"ebmnzbtbhjpglk\",\"plural\":\"ohdneuel\"},\"description\":\"hsd\",\"label\":\"t\",\"learnMoreLink\":\"fikdowwqu\",\"potentialBenefits\":\"xzxcl\",\"actions\":[{\"wdsjnkalju\":\"datahqzonosggbhcoh\",\"kfvhqcrailvpn\":\"dataiiswacffgdkzze\",\"mh\":\"datapfuflrw\"},{\"wqapnedgfbcvk\":\"dataxyjrxsagafcnih\",\"pkeqdcvdrhvoo\":\"datavq\"},{\"vnhdldwmgxcxr\":\"dataotbobzdopcj\",\"niyqslui\":\"datalpmutwuoegrpkhj\"},{\"modfvuefywsbpfvm\":\"datadggkzzlvmbmpa\",\"yzvqt\":\"datayhrfouyftaakcpw\",\"zksmondj\":\"datanubexk\"}],\"remediation\":{\"omgkopkwho\":\"dataxvy\",\"ajqgxy\":\"datav\",\"xozap\":\"datamocmbqfqvmk\",\"dd\":\"datahelxprglya\"},\"exposedMetadataProperties\":{\"ibrhosxsdqr\":\"databcuejrjxgci\",\"luszdtmhrkwof\":\"datazoymibmrqyibahw\",\"piexpbtgiw\":\"datayvoqa\",\"nwashrtd\":\"datawo\"}},\"id\":\"kcnqxwbpo\",\"name\":\"ulpiuj\",\"type\":\"aasipqi\"}]}"; + = "{\"value\":[{\"properties\":{\"category\":\"HighAvailability\",\"control\":\"ServiceUpgradeAndRetirement\",\"impact\":\"High\",\"impactedField\":\"ripltf\",\"impactedValue\":\"tbaxk\",\"criticalityScore\":\"ywrckp\",\"criticality\":\"lyhpluodpvruud\",\"scoreChangedAt\":\"zibt\",\"serviceGroupId\":\"stgktst\",\"savings\":{\"providerCurrency\":\"eclze\",\"billingCurrency\":\"bcvhzlhpl\",\"isDirectChannel\":false,\"resourceDeletedOn\":\"2021-05-30T19:04:16Z\",\"retail\":{\"potentialSavings\":98.54635415512955,\"potentialSavingsInBillingCurrency\":12.835465421811564,\"wastedTillDate\":19.94402149900325,\"wastedTillDateInBillingCurrency\":71.35798253168714,\"realizedSavings\":99.45029283878713,\"realizedSavingsInBillingCurrency\":89.68085765617599},\"contracted\":{\"potentialSavings\":43.959664818997865,\"potentialSavingsInBillingCurrency\":0.37646066266366907,\"wastedTillDate\":19.78120012165987,\"wastedTillDateInBillingCurrency\":19.477097696394907,\"realizedSavings\":70.81028158478131,\"realizedSavingsInBillingCurrency\":81.14254659057073}},\"recommendationStatus\":\"Completed\",\"completionType\":\"bskhudygoookkqfq\",\"recommendationDismissReason\":\"RiskIsAcceptable\",\"postponedUntilDateTime\":\"2021-03-17T22:00:43Z\",\"lastRefreshed\":\"2021-04-28T23:02:30Z\",\"lastUpdated\":\"2021-08-14T12:16:21Z\",\"createdTime\":\"2021-07-07T02:32:57Z\",\"metadata\":{\"qqybarye\":\"\\\"datatqzfavyv\\\"\",\"qgzsles\":\"\\\"dataayjkqa\\\"\",\"vbquwr\":\"\\\"datacbhernntiewdj\\\"\"},\"recommendationTypeId\":\"hwagohbuffkmrqe\",\"risk\":\"Error\",\"shortDescription\":{\"problem\":\"xtdr\",\"solution\":\"utacoe\"},\"suppressionId\":\"vewzcj\",\"extendedProperties\":{\"kahzo\":\"wcpmguaadraufac\"},\"resourceMetadata\":{\"resourceId\":\"j\",\"source\":\"uxxpshne\",\"action\":{\"lqubkwdlen\":\"\\\"datalfg\\\"\",\"utujba\":\"\\\"datad\\\"\"},\"singular\":\"juohminyflnorw\",\"plural\":\"uvwpklvxwmyg\"},\"description\":\"pgpqchiszepnnb\",\"label\":\"rxgibbd\",\"learnMoreLink\":\"confozauors\",\"potentialBenefits\":\"okwbqplh\",\"actions\":[{\"phwzsoldweyuqdu\":\"\\\"datauepzl\\\"\",\"biorktal\":\"\\\"datavmnnrw\\\"\",\"miloxggdufiqndie\":\"\\\"datawjhhgdnhxmsivf\\\"\",\"s\":\"\\\"datazaofjchvcyy\\\"\"},{\"oqonma\":\"\\\"datadotcubiipuip\\\"\",\"cimpevfg\":\"\\\"datajeknizshq\\\"\",\"rrilbywdxsmic\":\"\\\"datab\\\"\",\"qujizdvo\":\"\\\"datawrwfscjfnyns\\\"\"},{\"wb\":\"\\\"datatiby\\\"\",\"vutpthjoxo\":\"\\\"datalgy\\\"\"}],\"remediation\":{\"pi\":\"\\\"datasks\\\"\",\"xkcgxxlxsffgcvi\":\"\\\"datalqol\\\"\"},\"exposedMetadataProperties\":{\"w\":\"\\\"datadwl\\\"\",\"bdyhgkfminsgowz\":\"\\\"datayoupfgfbkj\\\"\",\"tgzukxitmmqt\":\"\\\"datattsttktlahbqact\\\"\",\"pjui\":\"\\\"dataqqqxhrnxrx\\\"\"},\"trackedProperties\":{\"priority\":\"Informational\"},\"review\":{\"id\":\"dzf\",\"name\":\"zivj\"},\"resourceWorkload\":{\"id\":\"qttbaj\",\"name\":\"atnwxyiopi\"},\"sourceSystem\":\"qqfkuv\",\"notes\":\"xkdmligo\"},\"id\":\"brxk\",\"name\":\"mloazuru\",\"type\":\"cbgoor\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); - PagedIterable response - = manager.recommendations().list("ssl", 1696619816, "fmmdnbbg", com.azure.core.util.Context.NONE); + PagedIterable response = manager.recommendations() + .list("ydbsd", RecommendationListMode.CONTEXTUAL, 36372091, "kx", com.azure.core.util.Context.NONE); - Assertions.assertEquals(Category.PERFORMANCE, response.iterator().next().category()); + Assertions.assertEquals(Category.HIGH_AVAILABILITY, response.iterator().next().category()); + Assertions.assertEquals(Control.SERVICE_UPGRADE_AND_RETIREMENT, response.iterator().next().control()); Assertions.assertEquals(Impact.HIGH, response.iterator().next().impact()); - Assertions.assertEquals("d", response.iterator().next().impactedField()); - Assertions.assertEquals("wyhzdx", response.iterator().next().impactedValue()); - Assertions.assertEquals(OffsetDateTime.parse("2021-03-28T04:38:02Z"), response.iterator().next().lastUpdated()); - Assertions.assertEquals("mweriofzpy", response.iterator().next().recommendationTypeId()); - Assertions.assertEquals("mwabnetshhszhedp", response.iterator().next().shortDescription().problem()); - Assertions.assertEquals("wiwubm", response.iterator().next().shortDescription().solution()); - Assertions.assertEquals(UUID.fromString("88e97085-36d6-4990-aaf1-656f4898e37d"), - response.iterator().next().suppressionIds().get(0)); - Assertions.assertEquals("ldnkwwtppjfl", response.iterator().next().extendedProperties().get("xogaokonzmnsikv")); - Assertions.assertEquals("dxunkbebxmubyyn", response.iterator().next().resourceMetadata().resourceId()); - Assertions.assertEquals("lrb", response.iterator().next().resourceMetadata().source()); - Assertions.assertEquals("ebmnzbtbhjpglk", response.iterator().next().resourceMetadata().singular()); - Assertions.assertEquals("ohdneuel", response.iterator().next().resourceMetadata().plural()); - Assertions.assertEquals("hsd", response.iterator().next().description()); - Assertions.assertEquals("t", response.iterator().next().label()); - Assertions.assertEquals("fikdowwqu", response.iterator().next().learnMoreLink()); - Assertions.assertEquals("xzxcl", response.iterator().next().potentialBenefits()); + Assertions.assertEquals("ripltf", response.iterator().next().impactedField()); + Assertions.assertEquals("tbaxk", response.iterator().next().impactedValue()); + Assertions.assertEquals(RecommendationStatus.COMPLETED, response.iterator().next().recommendationStatus()); + Assertions.assertEquals("bskhudygoookkqfq", response.iterator().next().completionType()); + Assertions.assertEquals(RecommendationDismissReason.RISK_IS_ACCEPTABLE, + response.iterator().next().recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-17T22:00:43Z"), + response.iterator().next().postponedUntilDateTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-28T23:02:30Z"), + response.iterator().next().lastRefreshed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-14T12:16:21Z"), response.iterator().next().lastUpdated()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-07T02:32:57Z"), response.iterator().next().createdTime()); + Assertions.assertEquals("hwagohbuffkmrqe", response.iterator().next().recommendationTypeId()); + Assertions.assertEquals(Risk.ERROR, response.iterator().next().risk()); + Assertions.assertEquals("xtdr", response.iterator().next().shortDescription().problem()); + Assertions.assertEquals("utacoe", response.iterator().next().shortDescription().solution()); + Assertions.assertEquals("vewzcj", response.iterator().next().suppressionId()); + Assertions.assertEquals("wcpmguaadraufac", response.iterator().next().extendedProperties().get("kahzo")); + Assertions.assertEquals("j", response.iterator().next().resourceMetadata().resourceId()); + Assertions.assertEquals("uxxpshne", response.iterator().next().resourceMetadata().source()); + Assertions.assertEquals("juohminyflnorw", response.iterator().next().resourceMetadata().singular()); + Assertions.assertEquals("uvwpklvxwmyg", response.iterator().next().resourceMetadata().plural()); + Assertions.assertEquals("pgpqchiszepnnb", response.iterator().next().description()); + Assertions.assertEquals("rxgibbd", response.iterator().next().label()); + Assertions.assertEquals("confozauors", response.iterator().next().learnMoreLink()); + Assertions.assertEquals("okwbqplh", response.iterator().next().potentialBenefits()); + Assertions.assertEquals(Priority.INFORMATIONAL, response.iterator().next().trackedProperties().priority()); + Assertions.assertEquals("dzf", response.iterator().next().review().id()); + Assertions.assertEquals("zivj", response.iterator().next().review().name()); + Assertions.assertEquals("qttbaj", response.iterator().next().resourceWorkload().id()); + Assertions.assertEquals("atnwxyiopi", response.iterator().next().resourceWorkload().name()); + Assertions.assertEquals("qqfkuv", response.iterator().next().sourceSystem()); + Assertions.assertEquals("xkdmligo", response.iterator().next().notes()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateByServiceGroupWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateByServiceGroupWithResponseMockTests.java new file mode 100644 index 0000000000000..991ac6fe0e2f6 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateByServiceGroupWithResponseMockTests.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; +import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.Priority; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationPatchPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatePropertiesPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import com.azure.resourcemanager.advisor.models.ResourceRecommendationBase; +import com.azure.resourcemanager.advisor.models.Risk; +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 RecommendationsUpdateByServiceGroupWithResponseMockTests { + @Test + public void testUpdateByServiceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"category\":\"OperationalExcellence\",\"control\":\"HighAvailability\",\"impact\":\"Medium\",\"impactedField\":\"oxdfgsftu\",\"impactedValue\":\"obrjlnacgcc\",\"criticalityScore\":\"nhxk\",\"criticality\":\"v\",\"scoreChangedAt\":\"nrzvuljraaer\",\"serviceGroupId\":\"okqgukkjq\",\"savings\":{\"providerCurrency\":\"roylaxxu\",\"billingCurrency\":\"disdosfjbjsvgj\",\"isDirectChannel\":false,\"resourceDeletedOn\":\"2021-08-20T16:23:01Z\",\"retail\":{\"potentialSavings\":95.2341366450254,\"potentialSavingsInBillingCurrency\":34.37395546371357,\"wastedTillDate\":50.47332662279261,\"wastedTillDateInBillingCurrency\":75.11625706136338,\"realizedSavings\":69.22184400594716,\"realizedSavingsInBillingCurrency\":97.62220358672418},\"contracted\":{\"potentialSavings\":72.00121421487124,\"potentialSavingsInBillingCurrency\":93.29044634533258,\"wastedTillDate\":22.65373093398031,\"wastedTillDateInBillingCurrency\":60.52986239953479,\"realizedSavings\":76.88735710119435,\"realizedSavingsInBillingCurrency\":0.7560743797621394}},\"recommendationStatus\":\"New\",\"completionType\":\"rphkmcrjdqnsdfz\",\"recommendationDismissReason\":\"AnAlternativeSolutionIsAlreadyInPlace\",\"postponedUntilDateTime\":\"2021-06-02T01:24:37Z\",\"lastRefreshed\":\"2021-02-01T03:05:30Z\",\"lastUpdated\":\"2021-10-30T22:45:55Z\",\"createdTime\":\"2021-09-07T04:02:55Z\",\"metadata\":{\"wxezwzhok\":\"\\\"datajeuut\\\"\",\"ehgpp\":\"\\\"databwnhhtql\\\"\"},\"recommendationTypeId\":\"ifhpf\",\"risk\":\"Warning\",\"shortDescription\":{\"problem\":\"gcxtxj\",\"solution\":\"heafidlt\"},\"suppressionId\":\"sr\",\"extendedProperties\":{\"wegprh\":\"kssjhoiftxfk\"},\"resourceMetadata\":{\"resourceId\":\"llu\",\"source\":\"iqtgdqoh\",\"action\":{\"libph\":\"\\\"datasldrizetpwbral\\\"\",\"a\":\"\\\"dataqzmiza\\\"\",\"joylh\":\"\\\"dataankjpdnjzh\\\"\",\"cjmeislstvasy\":\"\\\"datalmuoyxprimrsopte\\\"\"},\"singular\":\"xdza\",\"plural\":\"weoohguufuzboyj\"},\"description\":\"hwtzolb\",\"label\":\"mwmdxmebwjscjpa\",\"learnMoreLink\":\"xveabf\",\"potentialBenefits\":\"nmwmqtibx\",\"actions\":[{\"qcttadijaeukmrsi\":\"\\\"datadt\\\"\",\"eqw\":\"\\\"dataekpndzaapmudq\\\"\"},{\"znrtffyaqit\":\"\\\"datapibudqwyxebeybpm\\\"\"}],\"remediation\":{\"fuqyrxpdlcgqlsi\":\"\\\"dataeioqaqhvse\\\"\",\"rsjuivfcdisyir\":\"\\\"datamjqfrddgamquhio\\\"\"},\"exposedMetadataProperties\":{\"xrxzbujrtr\":\"\\\"datahcz\\\"\",\"khgn\":\"\\\"dataqvwre\\\"\",\"piqywnc\":\"\\\"datanzonzl\\\"\",\"zehtdhgb\":\"\\\"datajtszcof\\\"\"},\"trackedProperties\":{\"priority\":\"Critical\"},\"review\":{\"id\":\"jeamurv\",\"name\":\"lovuana\"},\"resourceWorkload\":{\"id\":\"xlpm\",\"name\":\"rbdkelvidiz\"},\"sourceSystem\":\"sdbccxjmonfdgnwn\",\"notes\":\"puuw\"},\"id\":\"tvuqjctzenkeifzz\",\"name\":\"mkdasv\",\"type\":\"lyhb\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ResourceRecommendationBase response + = manager.recommendations() + .updateByServiceGroupWithResponse("mes", "kdlpa", + new RecommendationPatchPayload().withProperties(new RecommendationStatePropertiesPayload() + .withRecommendationStatus(RecommendationStatus.COMPLETED) + .withRecommendationDismissReason(RecommendationDismissReason.RISK_IS_ACCEPTABLE) + .withPostponedUntilDateTime(OffsetDateTime.parse("2021-04-10T22:41:02Z"))), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(Category.OPERATIONAL_EXCELLENCE, response.category()); + Assertions.assertEquals(Control.HIGH_AVAILABILITY, response.control()); + Assertions.assertEquals(Impact.MEDIUM, response.impact()); + Assertions.assertEquals("oxdfgsftu", response.impactedField()); + Assertions.assertEquals("obrjlnacgcc", response.impactedValue()); + Assertions.assertEquals(RecommendationStatus.NEW, response.recommendationStatus()); + Assertions.assertEquals("rphkmcrjdqnsdfz", response.completionType()); + Assertions.assertEquals(RecommendationDismissReason.AN_ALTERNATIVE_SOLUTION_IS_ALREADY_IN_PLACE, + response.recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-02T01:24:37Z"), response.postponedUntilDateTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-01T03:05:30Z"), response.lastRefreshed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-30T22:45:55Z"), response.lastUpdated()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-07T04:02:55Z"), response.createdTime()); + Assertions.assertEquals("ifhpf", response.recommendationTypeId()); + Assertions.assertEquals(Risk.WARNING, response.risk()); + Assertions.assertEquals("gcxtxj", response.shortDescription().problem()); + Assertions.assertEquals("heafidlt", response.shortDescription().solution()); + Assertions.assertEquals("sr", response.suppressionId()); + Assertions.assertEquals("kssjhoiftxfk", response.extendedProperties().get("wegprh")); + Assertions.assertEquals("llu", response.resourceMetadata().resourceId()); + Assertions.assertEquals("iqtgdqoh", response.resourceMetadata().source()); + Assertions.assertEquals("xdza", response.resourceMetadata().singular()); + Assertions.assertEquals("weoohguufuzboyj", response.resourceMetadata().plural()); + Assertions.assertEquals("hwtzolb", response.description()); + Assertions.assertEquals("mwmdxmebwjscjpa", response.label()); + Assertions.assertEquals("xveabf", response.learnMoreLink()); + Assertions.assertEquals("nmwmqtibx", response.potentialBenefits()); + Assertions.assertEquals(Priority.CRITICAL, response.trackedProperties().priority()); + Assertions.assertEquals("jeamurv", response.review().id()); + Assertions.assertEquals("lovuana", response.review().name()); + Assertions.assertEquals("xlpm", response.resourceWorkload().id()); + Assertions.assertEquals("rbdkelvidiz", response.resourceWorkload().name()); + Assertions.assertEquals("sdbccxjmonfdgnwn", response.sourceSystem()); + Assertions.assertEquals("puuw", response.notes()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateWithResponseMockTests.java new file mode 100644 index 0000000000000..abfae40701148 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsUpdateWithResponseMockTests.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; +import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.Priority; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationPatchPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatePropertiesPayload; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import com.azure.resourcemanager.advisor.models.ResourceRecommendationBase; +import com.azure.resourcemanager.advisor.models.Risk; +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 RecommendationsUpdateWithResponseMockTests { + @Test + public void testUpdateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"category\":\"Security\",\"control\":\"PrioritizedRecommendations\",\"impact\":\"Low\",\"impactedField\":\"umwctondz\",\"impactedValue\":\"uu\",\"criticalityScore\":\"dlwggytsbwtovv\",\"criticality\":\"seinqfiuf\",\"scoreChangedAt\":\"knpirgnepttwq\",\"serviceGroupId\":\"niffcdmqnroj\",\"savings\":{\"providerCurrency\":\"jnkrxf\",\"billingCurrency\":\"dhcrati\",\"isDirectChannel\":true,\"resourceDeletedOn\":\"2021-10-20T07:10:22Z\",\"retail\":{\"potentialSavings\":8.129984152114634,\"potentialSavingsInBillingCurrency\":83.49753967951844,\"wastedTillDate\":28.09025773672068,\"wastedTillDateInBillingCurrency\":51.730084428522495,\"realizedSavings\":52.448474399472985,\"realizedSavingsInBillingCurrency\":96.03913839163111},\"contracted\":{\"potentialSavings\":92.62154384291183,\"potentialSavingsInBillingCurrency\":18.989409423086645,\"wastedTillDate\":49.87733446240953,\"wastedTillDateInBillingCurrency\":73.08256747250039,\"realizedSavings\":64.66455154980197,\"realizedSavingsInBillingCurrency\":50.031897887592706}},\"recommendationStatus\":\"Postponed\",\"completionType\":\"gthrrghxjbdhq\",\"recommendationDismissReason\":\"IncompatibleWithTheCurrentConfiguration\",\"postponedUntilDateTime\":\"2021-02-18T16:01:49Z\",\"lastRefreshed\":\"2021-08-03T04:18:25Z\",\"lastUpdated\":\"2021-06-30T13:21:57Z\",\"createdTime\":\"2021-09-30T11:14:42Z\",\"metadata\":{\"ybycnunvj\":\"\\\"datashrnsvbuswdvz\\\"\",\"ikyzirtxdy\":\"\\\"datartkfawnopq\\\"\",\"ejnt\":\"\\\"datax\\\"\"},\"recommendationTypeId\":\"ewgioilqukrydxt\",\"risk\":\"Error\",\"shortDescription\":{\"problem\":\"xorgg\",\"solution\":\"hyaomtbghhavgr\"},\"suppressionId\":\"ffovjzhpj\",\"extendedProperties\":{\"yo\":\"gjmfxumvfcl\"},\"resourceMetadata\":{\"resourceId\":\"nbkfezzxscy\",\"source\":\"zdgiruj\",\"action\":{\"qvpn\":\"\\\"dataomvzzbtd\\\"\",\"bgye\":\"\\\"datayujviylwdshfssn\\\"\",\"cotmr\":\"\\\"datarymsgaojfmw\\\"\"},\"singular\":\"irctymoxoftpipiw\",\"plural\":\"zuhx\"},\"description\":\"pqjlihhyusps\",\"label\":\"sdvlmfwdgzxulucv\",\"learnMoreLink\":\"mrsreuzvxurisjnh\",\"potentialBenefits\":\"txifqj\",\"actions\":[{\"upauut\":\"\\\"datarhublwpcesutrg\\\"\",\"qg\":\"\\\"datawoqhihe\\\"\",\"foimwkslircizjxv\":\"\\\"datazpnfqntcypsxj\\\"\"},{\"ftumrtwnawjslbiw\":\"\\\"datafceacvlhvygd\\\"\",\"fmznba\":\"\\\"dataojgcyzt\\\"\"}],\"remediation\":{\"huwrykqgaifm\":\"\\\"datahchqnrnrpx\\\"\"},\"exposedMetadataProperties\":{\"dvk\":\"\\\"datalb\\\"\",\"srhnjivo\":\"\\\"databejdznxcv\\\"\"},\"trackedProperties\":{\"priority\":\"Medium\"},\"review\":{\"id\":\"qfzgemjdftul\",\"name\":\"tduceamt\"},\"resourceWorkload\":{\"id\":\"u\",\"name\":\"ejwcwwqiok\"},\"sourceSystem\":\"sx\",\"notes\":\"jmsvpkjp\"},\"id\":\"kwcf\",\"name\":\"ql\",\"type\":\"yxgtczh\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ResourceRecommendationBase response + = manager.recommendations() + .updateWithResponse("cbihwqk", + new RecommendationPatchPayload().withProperties(new RecommendationStatePropertiesPayload() + .withRecommendationStatus(RecommendationStatus.POSTPONED) + .withRecommendationDismissReason(RecommendationDismissReason.OTHER) + .withPostponedUntilDateTime(OffsetDateTime.parse("2021-02-09T05:21:53Z"))), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(Category.SECURITY, response.category()); + Assertions.assertEquals(Control.PRIORITIZED_RECOMMENDATIONS, response.control()); + Assertions.assertEquals(Impact.LOW, response.impact()); + Assertions.assertEquals("umwctondz", response.impactedField()); + Assertions.assertEquals("uu", response.impactedValue()); + Assertions.assertEquals(RecommendationStatus.POSTPONED, response.recommendationStatus()); + Assertions.assertEquals("gthrrghxjbdhq", response.completionType()); + Assertions.assertEquals(RecommendationDismissReason.INCOMPATIBLE_WITH_THE_CURRENT_CONFIGURATION, + response.recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-18T16:01:49Z"), response.postponedUntilDateTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-03T04:18:25Z"), response.lastRefreshed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-30T13:21:57Z"), response.lastUpdated()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-30T11:14:42Z"), response.createdTime()); + Assertions.assertEquals("ewgioilqukrydxt", response.recommendationTypeId()); + Assertions.assertEquals(Risk.ERROR, response.risk()); + Assertions.assertEquals("xorgg", response.shortDescription().problem()); + Assertions.assertEquals("hyaomtbghhavgr", response.shortDescription().solution()); + Assertions.assertEquals("ffovjzhpj", response.suppressionId()); + Assertions.assertEquals("gjmfxumvfcl", response.extendedProperties().get("yo")); + Assertions.assertEquals("nbkfezzxscy", response.resourceMetadata().resourceId()); + Assertions.assertEquals("zdgiruj", response.resourceMetadata().source()); + Assertions.assertEquals("irctymoxoftpipiw", response.resourceMetadata().singular()); + Assertions.assertEquals("zuhx", response.resourceMetadata().plural()); + Assertions.assertEquals("pqjlihhyusps", response.description()); + Assertions.assertEquals("sdvlmfwdgzxulucv", response.label()); + Assertions.assertEquals("mrsreuzvxurisjnh", response.learnMoreLink()); + Assertions.assertEquals("txifqj", response.potentialBenefits()); + Assertions.assertEquals(Priority.MEDIUM, response.trackedProperties().priority()); + Assertions.assertEquals("qfzgemjdftul", response.review().id()); + Assertions.assertEquals("tduceamt", response.review().name()); + Assertions.assertEquals("u", response.resourceWorkload().id()); + Assertions.assertEquals("ejwcwwqiok", response.resourceWorkload().name()); + Assertions.assertEquals("sx", response.sourceSystem()); + Assertions.assertEquals("jmsvpkjp", response.notes()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewCollectionTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewCollectionTests.java new file mode 100644 index 0000000000000..cad29801fe547 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewCollectionTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.implementation.models.ResiliencyReviewCollection; +import org.junit.jupiter.api.Assertions; + +public final class ResiliencyReviewCollectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResiliencyReviewCollection model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"reviewName\":\"iekkezz\",\"workloadName\":\"hlyfjhdgqgg\",\"reviewStatus\":\"InProgress\",\"recommendationsCount\":1059730193,\"publishedAt\":\"g\",\"updatedAt\":\"qidbqfatpxllrxcy\"},\"id\":\"oadsuvar\",\"name\":\"ywdmjsjqbjh\",\"type\":\"yxxrwlycoduh\"},{\"properties\":{\"reviewName\":\"kgymareqnajxqug\",\"workloadName\":\"ky\",\"reviewStatus\":\"Completed\",\"recommendationsCount\":642347272,\"publishedAt\":\"gssofwq\",\"updatedAt\":\"qal\"},\"id\":\"mnjijpxacqqudf\",\"name\":\"byxbaaabjy\",\"type\":\"ayffim\"}],\"nextLink\":\"rtuzqogs\"}") + .toObject(ResiliencyReviewCollection.class); + Assertions.assertEquals("rtuzqogs", model.nextLink()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewInnerTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewInnerTests.java new file mode 100644 index 0000000000000..75a2e53f5b54c --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewInnerTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewInner; + +public final class ResiliencyReviewInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResiliencyReviewInner model = BinaryData.fromString( + "{\"properties\":{\"reviewName\":\"rvmnpkukghimdblx\",\"workloadName\":\"imfnjhfjx\",\"reviewStatus\":\"InProgress\",\"recommendationsCount\":1343784830,\"publishedAt\":\"foqreyfkzik\",\"updatedAt\":\"aw\"},\"id\":\"a\",\"name\":\"vxwc\",\"type\":\"elpcirelsfeaenwa\"}") + .toObject(ResiliencyReviewInner.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewPropertiesTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewPropertiesTests.java new file mode 100644 index 0000000000000..1084747d8b126 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewPropertiesTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewProperties; + +public final class ResiliencyReviewPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResiliencyReviewProperties model = BinaryData.fromString( + "{\"reviewName\":\"atklddxbjhwuaa\",\"workloadName\":\"zjosp\",\"reviewStatus\":\"New\",\"recommendationsCount\":113481876,\"publishedAt\":\"jrvxaglrv\",\"updatedAt\":\"jwosytxitcskfck\"}") + .toObject(ResiliencyReviewProperties.class); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsGetWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsGetWithResponseMockTests.java new file mode 100644 index 0000000000000..48c4d20cf4f1c --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsGetWithResponseMockTests.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.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.ResiliencyReview; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ResiliencyReviewsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"reviewName\":\"ntjlr\",\"workloadName\":\"jkskyr\",\"reviewStatus\":\"InProgress\",\"recommendationsCount\":714440003,\"publishedAt\":\"dsxwaab\",\"updatedAt\":\"ifrygzn\"},\"id\":\"axri\",\"name\":\"kzobgopxlhsln\",\"type\":\"lxieixynllxecwcr\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ResiliencyReview response + = manager.resiliencyReviews().getWithResponse("abpfhvfs", com.azure.core.util.Context.NONE).getValue(); + + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsListMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsListMockTests.java new file mode 100644 index 0000000000000..5cba61b18c9aa --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResiliencyReviewsListMockTests.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.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.ResiliencyReview; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ResiliencyReviewsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"reviewName\":\"tifdwfmvi\",\"workloadName\":\"rqjb\",\"reviewStatus\":\"InProgress\",\"recommendationsCount\":1175106778,\"publishedAt\":\"glka\",\"updatedAt\":\"onqjujeickpzvcpo\"},\"id\":\"xelnwc\",\"name\":\"tyjedex\",\"type\":\"mlfmkqs\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.resiliencyReviews().list(187387360, 1839785994, "hslhca", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceMetadataTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceMetadataTests.java index 943d3a92edc8c..2958577fe8501 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceMetadataTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceMetadataTests.java @@ -1,50 +1,22 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.util.BinaryData; import com.azure.resourcemanager.advisor.models.ResourceMetadata; -import java.util.HashMap; -import java.util.Map; import org.junit.jupiter.api.Assertions; public final class ResourceMetadataTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ResourceMetadata model = BinaryData.fromString( - "{\"resourceId\":\"nljky\",\"source\":\"j\",\"action\":{\"gidokgjljyoxgvcl\":\"dataj\",\"jhtxfvgxbfsmxne\":\"databgsncghkjeszzhb\"},\"singular\":\"pvecxgodeb\",\"plural\":\"kk\"}") + "{\"resourceId\":\"hfiqscjeypvhe\",\"source\":\"kgqhcjrefovg\",\"action\":{\"yvxyqjp\":\"\\\"datasle\\\"\"},\"singular\":\"attpngjcrcczsq\",\"plural\":\"hvmdajvnysounq\"}") .toObject(ResourceMetadata.class); - Assertions.assertEquals("nljky", model.resourceId()); - Assertions.assertEquals("j", model.source()); - Assertions.assertEquals("pvecxgodeb", model.singular()); - Assertions.assertEquals("kk", model.plural()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceMetadata model = new ResourceMetadata().withResourceId("nljky") - .withSource("j") - .withAction(mapOf("gidokgjljyoxgvcl", "dataj", "jhtxfvgxbfsmxne", "databgsncghkjeszzhb")) - .withSingular("pvecxgodeb") - .withPlural("kk"); - model = BinaryData.fromObject(model).toObject(ResourceMetadata.class); - Assertions.assertEquals("nljky", model.resourceId()); - Assertions.assertEquals("j", model.source()); - Assertions.assertEquals("pvecxgodeb", model.singular()); - Assertions.assertEquals("kk", model.plural()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; + Assertions.assertEquals("hfiqscjeypvhe", model.resourceId()); + Assertions.assertEquals("kgqhcjrefovg", model.source()); + Assertions.assertEquals("attpngjcrcczsq", model.singular()); + Assertions.assertEquals("hvmdajvnysounq", model.plural()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceProvidersPredictWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceProvidersPredictWithResponseMockTests.java new file mode 100644 index 0000000000000..8f81ffa7138a1 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceProvidersPredictWithResponseMockTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.core.util.BinaryData; +import com.azure.resourcemanager.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Impact; +import com.azure.resourcemanager.advisor.models.PredictionRequest; +import com.azure.resourcemanager.advisor.models.PredictionResponse; +import com.azure.resourcemanager.advisor.models.PredictionType; +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 ResourceProvidersPredictWithResponseMockTests { + @Test + public void testPredictWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"extendedProperties\":\"\\\"datatawfsdjpvkvp\\\"\",\"predictionType\":\"PredictiveRightsizing\",\"category\":\"HighAvailability\",\"impact\":\"High\",\"impactedField\":\"kd\",\"lastUpdated\":\"2021-11-16T21:56:05Z\",\"shortDescription\":{\"problem\":\"budurgkakmo\",\"solution\":\"hjjklff\"}}}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PredictionResponse response + = manager.resourceProviders() + .predictWithResponse(new PredictionRequest().withPredictionType(PredictionType.PREDICTIVE_RIGHTSIZING) + .withExtendedProperties(BinaryData.fromBytes("\"dataxzsjabib\"".getBytes(StandardCharsets.UTF_8))), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(PredictionType.PREDICTIVE_RIGHTSIZING, response.predictionType()); + Assertions.assertEquals(Category.HIGH_AVAILABILITY, response.category()); + Assertions.assertEquals(Impact.HIGH, response.impact()); + Assertions.assertEquals("kd", response.impactedField()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-16T21:56:05Z"), response.lastUpdated()); + Assertions.assertEquals("budurgkakmo", response.shortDescription().problem()); + Assertions.assertEquals("hjjklff", response.shortDescription().solution()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationBaseInnerTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationBaseInnerTests.java index f0e7dfab9b134..d113d3a68b1d7 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationBaseInnerTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationBaseInnerTests.java @@ -1,109 +1,60 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.util.BinaryData; import com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner; import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; import com.azure.resourcemanager.advisor.models.Impact; -import com.azure.resourcemanager.advisor.models.ResourceMetadata; -import com.azure.resourcemanager.advisor.models.ShortDescription; +import com.azure.resourcemanager.advisor.models.Priority; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import com.azure.resourcemanager.advisor.models.Risk; import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; import org.junit.jupiter.api.Assertions; public final class ResourceRecommendationBaseInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ResourceRecommendationBaseInner model = BinaryData.fromString( - "{\"properties\":{\"category\":\"Cost\",\"impact\":\"Low\",\"impactedField\":\"hrc\",\"impactedValue\":\"nc\",\"lastUpdated\":\"2021-10-26T02:35:50Z\",\"metadata\":{\"coofsxlzev\":\"datafvm\",\"abcypmivk\":\"databmqj\"},\"recommendationTypeId\":\"zuvccfwnfnbacfio\",\"shortDescription\":{\"problem\":\"bxetqgtzxdpn\",\"solution\":\"qqwx\"},\"suppressionIds\":[\"fb97e899-5556-44c5-9e90-2a14169d8826\",\"f44ebc13-50ee-4ea1-b9ee-ae4b8b8718b4\",\"b0e377f4-b007-43c3-a955-3e76089be614\"],\"extendedProperties\":{\"njampm\":\"llnwsubi\"},\"resourceMetadata\":{\"resourceId\":\"zscxaqwo\",\"source\":\"hcbonqvpkvlr\",\"action\":{\"eipheoflokeyy\":\"dataea\",\"jp\":\"dataenjbdlwtgrhp\"},\"singular\":\"masxazjpqyegu\",\"plural\":\"hb\"},\"description\":\"hejjz\",\"label\":\"dudgwdslfhot\",\"learnMoreLink\":\"cynpwlbjnp\",\"potentialBenefits\":\"cftadeh\",\"actions\":[{\"uesnzwdejbavo\":\"datayfsoppu\",\"vudwx\":\"dataxzdmohctb\",\"gujjugwdkcglh\":\"datandnvo\",\"ofqweykhmenevfye\":\"datalazjdyggdtjixhbk\"},{\"yvdcsitynnaa\":\"datawhybcib\",\"eypvhezrkg\":\"datadectehfiqsc\",\"sle\":\"datahcjrefovgmk\"}],\"remediation\":{\"k\":\"dataxyqj\",\"jh\":\"dataattpngjcrcczsq\",\"ysou\":\"datamdajv\",\"canoaeupf\":\"dataq\"},\"exposedMetadataProperties\":{\"cma\":\"dataltrpmopj\",\"kthfui\":\"datau\",\"odpuozmyzydag\":\"dataaodsfcpkv\",\"hrdxwzywqsmbs\":\"datauaxbezyiuokkt\"}},\"id\":\"reximoryocfs\",\"name\":\"ksymd\",\"type\":\"ys\"}") + "{\"properties\":{\"category\":\"Performance\",\"control\":\"DisasterRecovery\",\"impact\":\"Low\",\"impactedField\":\"ihnhun\",\"impactedValue\":\"wjzrnfygxgisp\",\"criticalityScore\":\"vtz\",\"criticality\":\"ufubl\",\"scoreChangedAt\":\"fxqeof\",\"serviceGroupId\":\"e\",\"savings\":{\"providerCurrency\":\"qjbasvms\",\"billingCurrency\":\"qulngsntnbybkzgc\",\"isDirectChannel\":false,\"resourceDeletedOn\":\"2021-09-26T22:03:54Z\",\"retail\":{\"potentialSavings\":56.598267899543366,\"potentialSavingsInBillingCurrency\":31.060992133865163,\"wastedTillDate\":72.06065164113062,\"wastedTillDateInBillingCurrency\":84.42350221104343,\"realizedSavings\":76.37581436714929,\"realizedSavingsInBillingCurrency\":22.258436427181326},\"contracted\":{\"potentialSavings\":17.40390041733808,\"potentialSavingsInBillingCurrency\":8.648524792300849,\"wastedTillDate\":98.36213425160699,\"wastedTillDateInBillingCurrency\":29.633217018002924,\"realizedSavings\":66.38584562037443,\"realizedSavingsInBillingCurrency\":16.933007960965362}},\"recommendationStatus\":\"Dismissed\",\"completionType\":\"inqpjwnzll\",\"recommendationDismissReason\":\"ImplementationStepsAreUnclear\",\"postponedUntilDateTime\":\"2021-07-25T07:38:35Z\",\"lastRefreshed\":\"2021-09-21T11:36:48Z\",\"lastUpdated\":\"2021-03-28T22:28:31Z\",\"createdTime\":\"2021-11-23T16:03:48Z\",\"metadata\":{\"zevndhkrwpdappds\":\"\\\"dataabkyqduujitcjcz\\\"\",\"snhu\":\"\\\"datadkvwrwjfe\\\"\",\"tmrldhugjzzdatq\":\"\\\"dataje\\\"\",\"gphuticndvka\":\"\\\"datahocdgeab\\\"\"},\"recommendationTypeId\":\"wyiftyhxhur\",\"risk\":\"None\",\"shortDescription\":{\"problem\":\"xolniwpwcukjfk\",\"solution\":\"awxklr\"},\"suppressionId\":\"lwckbasyypnddhs\",\"extendedProperties\":{\"qgoulznd\":\"acphejkoty\",\"wyqkgfgibm\":\"i\",\"qsrxybzqqed\":\"dgak\"},\"resourceMetadata\":{\"resourceId\":\"bciqfouflm\",\"source\":\"kzsmodm\",\"action\":{\"mutduqktaps\":\"\\\"dataugpbkw\\\"\",\"rtumkdosvq\":\"\\\"datawgcu\\\"\"},\"singular\":\"bmdg\",\"plural\":\"jfddgmbmbe\"},\"description\":\"pbhtqqrolfpfpsa\",\"label\":\"bquxigjy\",\"learnMoreLink\":\"zjaoyfhrtxil\",\"potentialBenefits\":\"rkujy\",\"actions\":[{\"awrlyx\":\"\\\"datajuvf\\\"\"}],\"remediation\":{\"nwbxgjvtbvpyssz\":\"\\\"datacpr\\\"\",\"guhmuouqfpr\":\"\\\"datanruj\\\"\"},\"exposedMetadataProperties\":{\"nwui\":\"\\\"databngui\\\"\",\"zuckyfi\":\"\\\"datagazxuf\\\"\",\"htymw\":\"\\\"datarfidfvzwdz\\\"\"},\"trackedProperties\":{\"priority\":\"Medium\"},\"review\":{\"id\":\"hwxmnteiwa\",\"name\":\"vkmijcmmxdcuf\"},\"resourceWorkload\":{\"id\":\"rpymzidnsez\",\"name\":\"tbzsgfyccs\"},\"sourceSystem\":\"wmdwzjeiachboo\",\"notes\":\"lnrosfqp\"},\"id\":\"ehzzvypyqrim\",\"name\":\"inpvswjdkirsoodq\",\"type\":\"hc\"}") .toObject(ResourceRecommendationBaseInner.class); - Assertions.assertEquals(Category.COST, model.category()); + Assertions.assertEquals(Category.PERFORMANCE, model.category()); + Assertions.assertEquals(Control.DISASTER_RECOVERY, model.control()); Assertions.assertEquals(Impact.LOW, model.impact()); - Assertions.assertEquals("hrc", model.impactedField()); - Assertions.assertEquals("nc", model.impactedValue()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-26T02:35:50Z"), model.lastUpdated()); - Assertions.assertEquals("zuvccfwnfnbacfio", model.recommendationTypeId()); - Assertions.assertEquals("bxetqgtzxdpn", model.shortDescription().problem()); - Assertions.assertEquals("qqwx", model.shortDescription().solution()); - Assertions.assertEquals(UUID.fromString("fb97e899-5556-44c5-9e90-2a14169d8826"), model.suppressionIds().get(0)); - Assertions.assertEquals("llnwsubi", model.extendedProperties().get("njampm")); - Assertions.assertEquals("zscxaqwo", model.resourceMetadata().resourceId()); - Assertions.assertEquals("hcbonqvpkvlr", model.resourceMetadata().source()); - Assertions.assertEquals("masxazjpqyegu", model.resourceMetadata().singular()); - Assertions.assertEquals("hb", model.resourceMetadata().plural()); - Assertions.assertEquals("hejjz", model.description()); - Assertions.assertEquals("dudgwdslfhot", model.label()); - Assertions.assertEquals("cynpwlbjnp", model.learnMoreLink()); - Assertions.assertEquals("cftadeh", model.potentialBenefits()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceRecommendationBaseInner model = new ResourceRecommendationBaseInner().withCategory(Category.COST) - .withImpact(Impact.LOW) - .withImpactedField("hrc") - .withImpactedValue("nc") - .withLastUpdated(OffsetDateTime.parse("2021-10-26T02:35:50Z")) - .withMetadata(mapOf("coofsxlzev", "datafvm", "abcypmivk", "databmqj")) - .withRecommendationTypeId("zuvccfwnfnbacfio") - .withShortDescription(new ShortDescription().withProblem("bxetqgtzxdpn").withSolution("qqwx")) - .withSuppressionIds(Arrays.asList(UUID.fromString("fb97e899-5556-44c5-9e90-2a14169d8826"), - UUID.fromString("f44ebc13-50ee-4ea1-b9ee-ae4b8b8718b4"), - UUID.fromString("b0e377f4-b007-43c3-a955-3e76089be614"))) - .withExtendedProperties(mapOf("njampm", "llnwsubi")) - .withResourceMetadata(new ResourceMetadata().withResourceId("zscxaqwo") - .withSource("hcbonqvpkvlr") - .withAction(mapOf("eipheoflokeyy", "dataea", "jp", "dataenjbdlwtgrhp")) - .withSingular("masxazjpqyegu") - .withPlural("hb")) - .withDescription("hejjz") - .withLabel("dudgwdslfhot") - .withLearnMoreLink("cynpwlbjnp") - .withPotentialBenefits("cftadeh") - .withActions(Arrays.asList( - mapOf("uesnzwdejbavo", "datayfsoppu", "vudwx", "dataxzdmohctb", "gujjugwdkcglh", "datandnvo", - "ofqweykhmenevfye", "datalazjdyggdtjixhbk"), - mapOf("yvdcsitynnaa", "datawhybcib", "eypvhezrkg", "datadectehfiqsc", "sle", "datahcjrefovgmk"))) - .withRemediation( - mapOf("k", "dataxyqj", "jh", "dataattpngjcrcczsq", "ysou", "datamdajv", "canoaeupf", "dataq")) - .withExposedMetadataProperties(mapOf("cma", "dataltrpmopj", "kthfui", "datau", "odpuozmyzydag", - "dataaodsfcpkv", "hrdxwzywqsmbs", "datauaxbezyiuokkt")); - model = BinaryData.fromObject(model).toObject(ResourceRecommendationBaseInner.class); - Assertions.assertEquals(Category.COST, model.category()); - Assertions.assertEquals(Impact.LOW, model.impact()); - Assertions.assertEquals("hrc", model.impactedField()); - Assertions.assertEquals("nc", model.impactedValue()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-26T02:35:50Z"), model.lastUpdated()); - Assertions.assertEquals("zuvccfwnfnbacfio", model.recommendationTypeId()); - Assertions.assertEquals("bxetqgtzxdpn", model.shortDescription().problem()); - Assertions.assertEquals("qqwx", model.shortDescription().solution()); - Assertions.assertEquals(UUID.fromString("fb97e899-5556-44c5-9e90-2a14169d8826"), model.suppressionIds().get(0)); - Assertions.assertEquals("llnwsubi", model.extendedProperties().get("njampm")); - Assertions.assertEquals("zscxaqwo", model.resourceMetadata().resourceId()); - Assertions.assertEquals("hcbonqvpkvlr", model.resourceMetadata().source()); - Assertions.assertEquals("masxazjpqyegu", model.resourceMetadata().singular()); - Assertions.assertEquals("hb", model.resourceMetadata().plural()); - Assertions.assertEquals("hejjz", model.description()); - Assertions.assertEquals("dudgwdslfhot", model.label()); - Assertions.assertEquals("cynpwlbjnp", model.learnMoreLink()); - Assertions.assertEquals("cftadeh", model.potentialBenefits()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; + Assertions.assertEquals("ihnhun", model.impactedField()); + Assertions.assertEquals("wjzrnfygxgisp", model.impactedValue()); + Assertions.assertEquals(RecommendationStatus.DISMISSED, model.recommendationStatus()); + Assertions.assertEquals("inqpjwnzll", model.completionType()); + Assertions.assertEquals(RecommendationDismissReason.IMPLEMENTATION_STEPS_ARE_UNCLEAR, + model.recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-25T07:38:35Z"), model.postponedUntilDateTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-21T11:36:48Z"), model.lastRefreshed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-28T22:28:31Z"), model.lastUpdated()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-23T16:03:48Z"), model.createdTime()); + Assertions.assertEquals("wyiftyhxhur", model.recommendationTypeId()); + Assertions.assertEquals(Risk.NONE, model.risk()); + Assertions.assertEquals("xolniwpwcukjfk", model.shortDescription().problem()); + Assertions.assertEquals("awxklr", model.shortDescription().solution()); + Assertions.assertEquals("lwckbasyypnddhs", model.suppressionId()); + Assertions.assertEquals("acphejkoty", model.extendedProperties().get("qgoulznd")); + Assertions.assertEquals("bciqfouflm", model.resourceMetadata().resourceId()); + Assertions.assertEquals("kzsmodm", model.resourceMetadata().source()); + Assertions.assertEquals("bmdg", model.resourceMetadata().singular()); + Assertions.assertEquals("jfddgmbmbe", model.resourceMetadata().plural()); + Assertions.assertEquals("pbhtqqrolfpfpsa", model.description()); + Assertions.assertEquals("bquxigjy", model.label()); + Assertions.assertEquals("zjaoyfhrtxil", model.learnMoreLink()); + Assertions.assertEquals("rkujy", model.potentialBenefits()); + Assertions.assertEquals(Priority.MEDIUM, model.trackedProperties().priority()); + Assertions.assertEquals("hwxmnteiwa", model.review().id()); + Assertions.assertEquals("vkmijcmmxdcuf", model.review().name()); + Assertions.assertEquals("rpymzidnsez", model.resourceWorkload().id()); + Assertions.assertEquals("tbzsgfyccs", model.resourceWorkload().name()); + Assertions.assertEquals("wmdwzjeiachboo", model.sourceSystem()); + Assertions.assertEquals("lnrosfqp", model.notes()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationBaseListResultTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationBaseListResultTests.java index 6adb9bca26368..c0384a877d734 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationBaseListResultTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationBaseListResultTests.java @@ -1,143 +1,62 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner; +import com.azure.resourcemanager.advisor.implementation.models.ResourceRecommendationBaseListResult; import com.azure.resourcemanager.advisor.models.Category; +import com.azure.resourcemanager.advisor.models.Control; import com.azure.resourcemanager.advisor.models.Impact; -import com.azure.resourcemanager.advisor.models.ResourceMetadata; -import com.azure.resourcemanager.advisor.models.ResourceRecommendationBaseListResult; -import com.azure.resourcemanager.advisor.models.ShortDescription; +import com.azure.resourcemanager.advisor.models.Priority; +import com.azure.resourcemanager.advisor.models.RecommendationDismissReason; +import com.azure.resourcemanager.advisor.models.RecommendationStatus; +import com.azure.resourcemanager.advisor.models.Risk; import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; import org.junit.jupiter.api.Assertions; public final class ResourceRecommendationBaseListResultTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { ResourceRecommendationBaseListResult model = BinaryData.fromString( - "{\"nextLink\":\"ufubl\",\"value\":[{\"properties\":{\"category\":\"Cost\",\"impact\":\"Low\",\"impactedField\":\"aeqjhqjbasvms\",\"impactedValue\":\"qulngsntnbybkzgc\",\"lastUpdated\":\"2021-05-07T11:10:21Z\",\"metadata\":{\"jdous\":\"dataxxwr\",\"xbnjbiksq\":\"datacqvkocrcjdkwtn\",\"ainqpjwnzlljfm\":\"datagls\",\"vmgxsab\":\"datapee\"},\"recommendationTypeId\":\"qduujitcjczdz\",\"shortDescription\":{\"problem\":\"dhkrwpdappdsbdk\",\"solution\":\"rwjfe\"},\"suppressionIds\":[\"cf861f59-54b4-4f32-b15b-132581e90998\",\"f3591c80-7825-4739-94b5-5f29b359dfd1\",\"ffb90a62-3cb3-46ff-9461-f82e651957ff\",\"1e95b12a-cec3-4ebc-8283-7a88298f4953\"],\"extendedProperties\":{\"rl\":\"tjelt\",\"geablgphuticndvk\":\"hugjzzdatqxhoc\",\"ftyxolniw\":\"ozwyiftyhxhuro\",\"ryplwckbasyypn\":\"wcukjfkgiawxk\"},\"resourceMetadata\":{\"resourceId\":\"sgcbac\",\"source\":\"ejk\",\"action\":{\"wyqkgfgibm\":\"datanqgoulzndli\",\"qsrxybzqqed\":\"datadgak\",\"iqfouflmmnkz\":\"dataytb\",\"wtmutduq\":\"datamodmglougpb\"},\"singular\":\"ap\",\"plural\":\"wgcu\"},\"description\":\"tumkdosvqwhbm\",\"label\":\"bbjfddgmbmbexp\",\"learnMoreLink\":\"htqqrolfp\",\"potentialBenefits\":\"s\",\"actions\":[{\"gjyjgzjaoyfhrtxi\":\"dataqux\",\"rkujy\":\"datan\"},{\"juvf\":\"datal\",\"jkcpr\":\"dataawrlyx\",\"nruj\":\"datanwbxgjvtbvpyssz\"}],\"remediation\":{\"uitnwuiz\":\"datahmuouqfprwzwbn\",\"x\":\"dataa\",\"hr\":\"datafizuckyf\",\"zwdzuh\":\"dataidf\"},\"exposedMetadataProperties\":{\"wxmnteiwao\":\"datawisdkft\",\"fsrpymzidnse\":\"datavkmijcmmxdcuf\",\"yc\":\"datacxtbzsg\",\"mdwzjeiachboo\":\"datasne\"}},\"id\":\"flnrosfqpteehzz\",\"name\":\"ypyqrimzinp\",\"type\":\"swjdkirso\"},{\"properties\":{\"category\":\"HighAvailability\",\"impact\":\"Low\",\"impactedField\":\"mnoh\",\"impactedValue\":\"ckwhds\",\"lastUpdated\":\"2021-07-22T01:38:16Z\",\"metadata\":{\"jxsqwpgrjbz\":\"datai\"},\"recommendationTypeId\":\"rcjxvsnbyxqabn\",\"shortDescription\":{\"problem\":\"pcyshu\",\"solution\":\"afbljjgpbtoqcjmk\"},\"suppressionIds\":[\"40f7c3ce-7323-4cfa-a559-713939d9530e\"],\"extendedProperties\":{\"pku\":\"qidtqajzyu\",\"gqexzlocxs\":\"jkrlkhbzhfepg\"},\"resourceMetadata\":{\"resourceId\":\"ierhhbcsglummaj\",\"source\":\"aodxo\",\"action\":{\"kajionpim\":\"datadxkqpx\",\"txgcpodgmaajr\":\"dataxg\",\"lwhijcoejctbzaq\":\"datavdjwzrlovm\"},\"singular\":\"sycbkbfk\",\"plural\":\"kdkexxp\"},\"description\":\"fmxa\",\"label\":\"fjpgddtocjjxhvp\",\"learnMoreLink\":\"uexhdzx\",\"potentialBenefits\":\"qeojnxqbzvddntw\",\"actions\":[{\"hcffcyddglmjthjq\":\"datacbtwnpzaoqvuh\",\"hix\":\"datawpyeicxmqciwqvh\",\"og\":\"dataigdtopbob\"}],\"remediation\":{\"a\":\"dataw\"},\"exposedMetadataProperties\":{\"iotkftutqxl\":\"datahrzayvvtpgvdf\",\"mi\":\"datagxlefgugnxkrxd\",\"abhjybi\":\"datatthzrvqd\"}},\"id\":\"ehoqfbowskan\",\"name\":\"ktzlcuiywg\",\"type\":\"ywgndrv\"}]}") + "{\"value\":[{\"properties\":{\"category\":\"OperationalExcellence\",\"control\":\"BusinessContinuity\",\"impact\":\"Medium\",\"impactedField\":\"o\",\"impactedValue\":\"ocfs\",\"criticalityScore\":\"s\",\"criticality\":\"ddystkiiuxhqy\",\"scoreChangedAt\":\"xorrqnb\",\"serviceGroupId\":\"czvyifq\",\"savings\":{\"providerCurrency\":\"dvjsllrmvvdf\",\"billingCurrency\":\"t\",\"isDirectChannel\":false,\"resourceDeletedOn\":\"2021-11-08T07:16:59Z\",\"retail\":{\"potentialSavings\":45.37643746655553,\"potentialSavingsInBillingCurrency\":84.77462082974397,\"wastedTillDate\":47.931661911187106,\"wastedTillDateInBillingCurrency\":85.41330136698888,\"realizedSavings\":6.969662117089626,\"realizedSavingsInBillingCurrency\":2.901344900856051},\"contracted\":{\"potentialSavings\":70.10904951109774,\"potentialSavingsInBillingCurrency\":41.57621773454808,\"wastedTillDate\":93.83553243542615,\"wastedTillDateInBillingCurrency\":41.2730038513229,\"realizedSavings\":94.99898998286235,\"realizedSavingsInBillingCurrency\":72.1345356002445}},\"recommendationStatus\":\"Postponed\",\"completionType\":\"mflbv\",\"recommendationDismissReason\":\"ExcessiveCostInvestmentRequired\",\"postponedUntilDateTime\":\"2021-11-01T14:14:41Z\",\"lastRefreshed\":\"2021-03-04T23:54:12Z\",\"lastUpdated\":\"2021-04-05T08:00:08Z\",\"createdTime\":\"2021-02-22T11:28:36Z\",\"metadata\":{\"foskghsauuimj\":\"\\\"datauqkhrsajiwku\\\"\"},\"recommendationTypeId\":\"xieduugidyjrr\",\"risk\":\"Error\",\"shortDescription\":{\"problem\":\"svexcsonpclhoco\",\"solution\":\"lkevle\"},\"suppressionId\":\"zfbuhf\",\"extendedProperties\":{\"th\":\"axkffei\",\"shxmzsbbzoggigrx\":\"vmezy\",\"ptkoenkoukn\":\"burvjxxjnspy\"},\"resourceMetadata\":{\"resourceId\":\"wtiukbldn\",\"source\":\"pocipazyxoegu\",\"action\":{\"mrbpizcdrqj\":\"\\\"datanpiucgygevqznty\\\"\",\"yhxdeoejzicwi\":\"\\\"datadpydn\\\"\",\"bkh\":\"\\\"datasjttgzfbish\\\"\"},\"singular\":\"deyeamdphagalpbu\",\"plural\":\"gipwhonowkg\"},\"description\":\"wankixzbi\",\"label\":\"eputtmrywnuzoqf\",\"learnMoreLink\":\"yqzrnkcqvyxlw\",\"potentialBenefits\":\"lsicohoqqnwv\",\"actions\":[{\"konocu\":\"\\\"datavwhheunmmqhgyx\\\"\",\"zf\":\"\\\"dataoklyaxuconuq\\\"\",\"vjektcxsenh\":\"\\\"databeypewrmjmw\\\"\"}],\"remediation\":{\"frzpwvlqdqgb\":\"\\\"datas\\\"\",\"fcivfsnkym\":\"\\\"dataqylihkaetckt\\\"\",\"jf\":\"\\\"datactq\\\"\",\"fuwutttxf\":\"\\\"dataebrjcxe\\\"\"},\"exposedMetadataProperties\":{\"fnljky\":\"\\\"databirphxepcyva\\\"\",\"ljyoxgvcltb\":\"\\\"dataxjvuujqgidokg\\\"\"},\"trackedProperties\":{\"priority\":\"Low\"},\"review\":{\"id\":\"kjeszz\",\"name\":\"ijhtxf\"},\"resourceWorkload\":{\"id\":\"bfs\",\"name\":\"nehmpvecx\"},\"sourceSystem\":\"debfqkkrbmpukgri\",\"notes\":\"lzlfbxzpuz\"},\"id\":\"ispnqzahmgkbrp\",\"name\":\"y\",\"type\":\"hibnuqqkpika\"},{\"properties\":{\"category\":\"Security\",\"control\":\"ServiceUpgradeAndRetirement\",\"impact\":\"Medium\",\"impactedField\":\"buynhijggm\",\"impactedValue\":\"fsiarbutr\",\"criticalityScore\":\"pnazzm\",\"criticality\":\"runmp\",\"scoreChangedAt\":\"tdbhrbnla\",\"serviceGroupId\":\"xmyskp\",\"savings\":{\"providerCurrency\":\"nbtkcxywnytnr\",\"billingCurrency\":\"nlqidybyxczf\",\"isDirectChannel\":true,\"resourceDeletedOn\":\"2021-01-18T05:48:26Z\",\"retail\":{\"potentialSavings\":71.06123911787623,\"potentialSavingsInBillingCurrency\":4.33005629706712,\"wastedTillDate\":81.35667144255959,\"wastedTillDateInBillingCurrency\":49.89188490883186,\"realizedSavings\":56.6381249954317,\"realizedSavingsInBillingCurrency\":36.612231953159714},\"contracted\":{\"potentialSavings\":97.37790907791091,\"potentialSavingsInBillingCurrency\":98.78118258064285,\"wastedTillDate\":13.763040489265588,\"wastedTillDateInBillingCurrency\":2.4403364559181906,\"realizedSavings\":21.232437081965404,\"realizedSavingsInBillingCurrency\":85.61408504569917}},\"recommendationStatus\":\"Completed\",\"completionType\":\"ckzywbiexzfeyue\",\"recommendationDismissReason\":\"Other\",\"postponedUntilDateTime\":\"2021-05-01T16:37:43Z\",\"lastRefreshed\":\"2021-10-23T16:09:08Z\",\"lastUpdated\":\"2021-09-10T00:08:50Z\",\"createdTime\":\"2021-09-09T17:36:53Z\",\"metadata\":{\"xaepdkzjancuxr\":\"\\\"datalmuzy\\\"\",\"bavxbniwdjswzt\":\"\\\"datad\\\"\",\"xbzpfzab\":\"\\\"datadbpgnxytxhp\\\"\",\"ovplw\":\"\\\"datalcuhxwtctyqiklb\\\"\"},\"recommendationTypeId\":\"hvgyuguosvmk\",\"risk\":\"None\",\"shortDescription\":{\"problem\":\"ukkfplgmgs\",\"solution\":\"kjz\"},\"suppressionId\":\"es\",\"extendedProperties\":{\"xpkd\":\"lopwiyig\",\"iuebbaumny\":\"zb\",\"txp\":\"upedeojnabckhs\"},\"resourceMetadata\":{\"resourceId\":\"btfhvpesaps\",\"source\":\"dqmh\",\"action\":{\"zxuutkncwscwsvl\":\"\\\"datahtldwk\\\"\",\"vnm\":\"\\\"dataotogtwrupqs\\\"\",\"eil\":\"\\\"datacykvceo\\\"\"},\"singular\":\"notyfjfcnjbkcn\",\"plural\":\"hbttkphyw\"},\"description\":\"vjtoqnermclfp\",\"label\":\"hoxus\",\"learnMoreLink\":\"pabgyeps\",\"potentialBenefits\":\"tazqugxywpmueefj\",\"actions\":[{\"glaocq\":\"\\\"datakqujidsuyono\\\"\",\"g\":\"\\\"datatcc\\\"\",\"wfudwpzntxhdzhl\":\"\\\"dataudxytlmoyrx\\\"\"},{\"sbkyvpycanuzbp\":\"\\\"datajbhckfrlhr\\\"\"}],\"remediation\":{\"v\":\"\\\"datafkuwbcrnwbmehhse\\\"\",\"tslhspkdeem\":\"\\\"dataus\\\"\"},\"exposedMetadataProperties\":{\"gkvtmelmqkrhah\":\"\\\"datamx\\\"\"},\"trackedProperties\":{\"priority\":\"Critical\"},\"review\":{\"id\":\"aquhcdhm\",\"name\":\"alaexqpvfadmwsrc\"},\"resourceWorkload\":{\"id\":\"xpvgo\",\"name\":\"lf\"},\"sourceSystem\":\"sgwbnbbeld\",\"notes\":\"k\"},\"id\":\"ali\",\"name\":\"urqhaka\",\"type\":\"hashsfwxosow\"},{\"properties\":{\"category\":\"OperationalExcellence\",\"control\":\"HighAvailability\",\"impact\":\"Medium\",\"impactedField\":\"oxdjebwpuc\",\"impactedValue\":\"fvovbvmeuecivy\",\"criticalityScore\":\"ce\",\"criticality\":\"jgjrwjueiotwm\",\"scoreChangedAt\":\"ytdxwit\",\"serviceGroupId\":\"rjaw\",\"savings\":{\"providerCurrency\":\"gxhnisk\",\"billingCurrency\":\"bkpyc\",\"isDirectChannel\":false,\"resourceDeletedOn\":\"2021-08-31T09:32:10Z\",\"retail\":{\"potentialSavings\":74.10968013108375,\"potentialSavingsInBillingCurrency\":81.77565030397092,\"wastedTillDate\":47.58473001088378,\"wastedTillDateInBillingCurrency\":0.6057880275014971,\"realizedSavings\":66.89834885346782,\"realizedSavingsInBillingCurrency\":3.2213087094423054},\"contracted\":{\"potentialSavings\":79.5004423009667,\"potentialSavingsInBillingCurrency\":49.440153203994065,\"wastedTillDate\":50.72233143657873,\"wastedTillDateInBillingCurrency\":48.199408333035976,\"realizedSavings\":76.77146967165868,\"realizedSavingsInBillingCurrency\":66.45964312973082}},\"recommendationStatus\":\"New\",\"completionType\":\"pjmkhfxobbc\",\"recommendationDismissReason\":\"AnAlternativeSolutionIsAlreadyInPlace\",\"postponedUntilDateTime\":\"2021-11-01T16:23:57Z\",\"lastRefreshed\":\"2021-01-30T14:58:59Z\",\"lastUpdated\":\"2021-04-01T12:50:08Z\",\"createdTime\":\"2021-03-19T14:55:09Z\",\"metadata\":{\"lcgwxzvlvqh\":\"\\\"databewtghfg\\\"\",\"mxiebw\":\"\\\"datakbegibt\\\"\",\"gwyzm\":\"\\\"dataaloayqcgwrtzju\\\"\",\"mtsavjcbpwxqp\":\"\\\"datatxon\\\"\"},\"recommendationTypeId\":\"knftguvriuh\",\"risk\":\"Warning\",\"shortDescription\":{\"problem\":\"yvxqtayriwwroy\",\"solution\":\"exrmcqibycnojvk\"},\"suppressionId\":\"e\",\"extendedProperties\":{\"apj\":\"gzva\",\"zlmwlxkvugfhz\":\"zhpvgqzcjrvxd\",\"hnnpr\":\"vawjvzunlu\",\"ultskzbbtdz\":\"xipeilpjzuaejx\"},\"resourceMetadata\":{\"resourceId\":\"e\",\"source\":\"gpw\",\"action\":{\"yofd\":\"\\\"datahkfpbs\\\"\"},\"singular\":\"uusdttouwa\",\"plural\":\"ekqvkeln\"},\"description\":\"vbxwyjsflhh\",\"label\":\"aln\",\"learnMoreLink\":\"xisxyawjoyaqcsl\",\"potentialBenefits\":\"pkii\",\"actions\":[{\"lhbnxkna\":\"\\\"dataxznelixhnrztf\\\"\",\"pnapnyiropuh\":\"\\\"dataaulppggd\\\"\",\"git\":\"\\\"dataigvpgylg\\\"\"}],\"remediation\":{\"n\":\"\\\"datadjvcsl\\\"\",\"rmgucnap\":\"\\\"datawwncwzzhxgk\\\"\",\"oellwp\":\"\\\"datat\\\"\"},\"exposedMetadataProperties\":{\"ac\":\"\\\"dataygpfqb\\\"\"},\"trackedProperties\":{\"priority\":\"Informational\"},\"review\":{\"id\":\"rhhuaopppcqeqx\",\"name\":\"z\"},\"resourceWorkload\":{\"id\":\"zxctobgb\",\"name\":\"moizpos\"},\"sourceSystem\":\"grcfb\",\"notes\":\"rmfqjhhkxbpvj\"},\"id\":\"jhxxjyn\",\"name\":\"u\",\"type\":\"ivkrtsw\"}],\"nextLink\":\"qzvszjf\"}") .toObject(ResourceRecommendationBaseListResult.class); - Assertions.assertEquals("ufubl", model.nextLink()); - Assertions.assertEquals(Category.COST, model.value().get(0).category()); - Assertions.assertEquals(Impact.LOW, model.value().get(0).impact()); - Assertions.assertEquals("aeqjhqjbasvms", model.value().get(0).impactedField()); - Assertions.assertEquals("qulngsntnbybkzgc", model.value().get(0).impactedValue()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-07T11:10:21Z"), model.value().get(0).lastUpdated()); - Assertions.assertEquals("qduujitcjczdz", model.value().get(0).recommendationTypeId()); - Assertions.assertEquals("dhkrwpdappdsbdk", model.value().get(0).shortDescription().problem()); - Assertions.assertEquals("rwjfe", model.value().get(0).shortDescription().solution()); - Assertions.assertEquals(UUID.fromString("cf861f59-54b4-4f32-b15b-132581e90998"), - model.value().get(0).suppressionIds().get(0)); - Assertions.assertEquals("tjelt", model.value().get(0).extendedProperties().get("rl")); - Assertions.assertEquals("sgcbac", model.value().get(0).resourceMetadata().resourceId()); - Assertions.assertEquals("ejk", model.value().get(0).resourceMetadata().source()); - Assertions.assertEquals("ap", model.value().get(0).resourceMetadata().singular()); - Assertions.assertEquals("wgcu", model.value().get(0).resourceMetadata().plural()); - Assertions.assertEquals("tumkdosvqwhbm", model.value().get(0).description()); - Assertions.assertEquals("bbjfddgmbmbexp", model.value().get(0).label()); - Assertions.assertEquals("htqqrolfp", model.value().get(0).learnMoreLink()); - Assertions.assertEquals("s", model.value().get(0).potentialBenefits()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ResourceRecommendationBaseListResult model = new ResourceRecommendationBaseListResult().withNextLink("ufubl") - .withValue(Arrays.asList( - new ResourceRecommendationBaseInner().withCategory(Category.COST) - .withImpact(Impact.LOW) - .withImpactedField("aeqjhqjbasvms") - .withImpactedValue("qulngsntnbybkzgc") - .withLastUpdated(OffsetDateTime.parse("2021-05-07T11:10:21Z")) - .withMetadata(mapOf("jdous", "dataxxwr", "xbnjbiksq", "datacqvkocrcjdkwtn", "ainqpjwnzlljfm", - "datagls", "vmgxsab", "datapee")) - .withRecommendationTypeId("qduujitcjczdz") - .withShortDescription(new ShortDescription().withProblem("dhkrwpdappdsbdk").withSolution("rwjfe")) - .withSuppressionIds(Arrays.asList(UUID.fromString("cf861f59-54b4-4f32-b15b-132581e90998"), - UUID.fromString("f3591c80-7825-4739-94b5-5f29b359dfd1"), - UUID.fromString("ffb90a62-3cb3-46ff-9461-f82e651957ff"), - UUID.fromString("1e95b12a-cec3-4ebc-8283-7a88298f4953"))) - .withExtendedProperties(mapOf("rl", "tjelt", "geablgphuticndvk", "hugjzzdatqxhoc", "ftyxolniw", - "ozwyiftyhxhuro", "ryplwckbasyypn", "wcukjfkgiawxk")) - .withResourceMetadata(new ResourceMetadata().withResourceId("sgcbac") - .withSource("ejk") - .withAction(mapOf("wyqkgfgibm", "datanqgoulzndli", "qsrxybzqqed", "datadgak", "iqfouflmmnkz", - "dataytb", "wtmutduq", "datamodmglougpb")) - .withSingular("ap") - .withPlural("wgcu")) - .withDescription("tumkdosvqwhbm") - .withLabel("bbjfddgmbmbexp") - .withLearnMoreLink("htqqrolfp") - .withPotentialBenefits("s") - .withActions(Arrays.asList(mapOf("gjyjgzjaoyfhrtxi", "dataqux", "rkujy", "datan"), - mapOf("juvf", "datal", "jkcpr", "dataawrlyx", "nruj", "datanwbxgjvtbvpyssz"))) - .withRemediation(mapOf("uitnwuiz", "datahmuouqfprwzwbn", "x", "dataa", "hr", "datafizuckyf", - "zwdzuh", "dataidf")) - .withExposedMetadataProperties(mapOf("wxmnteiwao", "datawisdkft", "fsrpymzidnse", - "datavkmijcmmxdcuf", "yc", "datacxtbzsg", "mdwzjeiachboo", "datasne")), - new ResourceRecommendationBaseInner().withCategory(Category.HIGH_AVAILABILITY) - .withImpact(Impact.LOW) - .withImpactedField("mnoh") - .withImpactedValue("ckwhds") - .withLastUpdated(OffsetDateTime.parse("2021-07-22T01:38:16Z")) - .withMetadata(mapOf("jxsqwpgrjbz", "datai")) - .withRecommendationTypeId("rcjxvsnbyxqabn") - .withShortDescription(new ShortDescription().withProblem("pcyshu").withSolution("afbljjgpbtoqcjmk")) - .withSuppressionIds(Arrays.asList(UUID.fromString("40f7c3ce-7323-4cfa-a559-713939d9530e"))) - .withExtendedProperties(mapOf("pku", "qidtqajzyu", "gqexzlocxs", "jkrlkhbzhfepg")) - .withResourceMetadata(new ResourceMetadata().withResourceId("ierhhbcsglummaj") - .withSource("aodxo") - .withAction(mapOf("kajionpim", "datadxkqpx", "txgcpodgmaajr", "dataxg", "lwhijcoejctbzaq", - "datavdjwzrlovm")) - .withSingular("sycbkbfk") - .withPlural("kdkexxp")) - .withDescription("fmxa") - .withLabel("fjpgddtocjjxhvp") - .withLearnMoreLink("uexhdzx") - .withPotentialBenefits("qeojnxqbzvddntw") - .withActions(Arrays.asList(mapOf("hcffcyddglmjthjq", "datacbtwnpzaoqvuh", "hix", - "datawpyeicxmqciwqvh", "og", "dataigdtopbob"))) - .withRemediation(mapOf("a", "dataw")) - .withExposedMetadataProperties(mapOf("iotkftutqxl", "datahrzayvvtpgvdf", "mi", "datagxlefgugnxkrxd", - "abhjybi", "datatthzrvqd")))); - model = BinaryData.fromObject(model).toObject(ResourceRecommendationBaseListResult.class); - Assertions.assertEquals("ufubl", model.nextLink()); - Assertions.assertEquals(Category.COST, model.value().get(0).category()); - Assertions.assertEquals(Impact.LOW, model.value().get(0).impact()); - Assertions.assertEquals("aeqjhqjbasvms", model.value().get(0).impactedField()); - Assertions.assertEquals("qulngsntnbybkzgc", model.value().get(0).impactedValue()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-07T11:10:21Z"), model.value().get(0).lastUpdated()); - Assertions.assertEquals("qduujitcjczdz", model.value().get(0).recommendationTypeId()); - Assertions.assertEquals("dhkrwpdappdsbdk", model.value().get(0).shortDescription().problem()); - Assertions.assertEquals("rwjfe", model.value().get(0).shortDescription().solution()); - Assertions.assertEquals(UUID.fromString("cf861f59-54b4-4f32-b15b-132581e90998"), - model.value().get(0).suppressionIds().get(0)); - Assertions.assertEquals("tjelt", model.value().get(0).extendedProperties().get("rl")); - Assertions.assertEquals("sgcbac", model.value().get(0).resourceMetadata().resourceId()); - Assertions.assertEquals("ejk", model.value().get(0).resourceMetadata().source()); - Assertions.assertEquals("ap", model.value().get(0).resourceMetadata().singular()); - Assertions.assertEquals("wgcu", model.value().get(0).resourceMetadata().plural()); - Assertions.assertEquals("tumkdosvqwhbm", model.value().get(0).description()); - Assertions.assertEquals("bbjfddgmbmbexp", model.value().get(0).label()); - Assertions.assertEquals("htqqrolfp", model.value().get(0).learnMoreLink()); - Assertions.assertEquals("s", model.value().get(0).potentialBenefits()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; + Assertions.assertEquals(Category.OPERATIONAL_EXCELLENCE, model.value().get(0).category()); + Assertions.assertEquals(Control.BUSINESS_CONTINUITY, model.value().get(0).control()); + Assertions.assertEquals(Impact.MEDIUM, model.value().get(0).impact()); + Assertions.assertEquals("o", model.value().get(0).impactedField()); + Assertions.assertEquals("ocfs", model.value().get(0).impactedValue()); + Assertions.assertEquals(RecommendationStatus.POSTPONED, model.value().get(0).recommendationStatus()); + Assertions.assertEquals("mflbv", model.value().get(0).completionType()); + Assertions.assertEquals(RecommendationDismissReason.EXCESSIVE_COST_INVESTMENT_REQUIRED, + model.value().get(0).recommendationDismissReason()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-01T14:14:41Z"), + model.value().get(0).postponedUntilDateTime()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-04T23:54:12Z"), model.value().get(0).lastRefreshed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-05T08:00:08Z"), model.value().get(0).lastUpdated()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-22T11:28:36Z"), model.value().get(0).createdTime()); + Assertions.assertEquals("xieduugidyjrr", model.value().get(0).recommendationTypeId()); + Assertions.assertEquals(Risk.ERROR, model.value().get(0).risk()); + Assertions.assertEquals("svexcsonpclhoco", model.value().get(0).shortDescription().problem()); + Assertions.assertEquals("lkevle", model.value().get(0).shortDescription().solution()); + Assertions.assertEquals("zfbuhf", model.value().get(0).suppressionId()); + Assertions.assertEquals("axkffei", model.value().get(0).extendedProperties().get("th")); + Assertions.assertEquals("wtiukbldn", model.value().get(0).resourceMetadata().resourceId()); + Assertions.assertEquals("pocipazyxoegu", model.value().get(0).resourceMetadata().source()); + Assertions.assertEquals("deyeamdphagalpbu", model.value().get(0).resourceMetadata().singular()); + Assertions.assertEquals("gipwhonowkg", model.value().get(0).resourceMetadata().plural()); + Assertions.assertEquals("wankixzbi", model.value().get(0).description()); + Assertions.assertEquals("eputtmrywnuzoqf", model.value().get(0).label()); + Assertions.assertEquals("yqzrnkcqvyxlw", model.value().get(0).learnMoreLink()); + Assertions.assertEquals("lsicohoqqnwv", model.value().get(0).potentialBenefits()); + Assertions.assertEquals(Priority.LOW, model.value().get(0).trackedProperties().priority()); + Assertions.assertEquals("kjeszz", model.value().get(0).review().id()); + Assertions.assertEquals("ijhtxf", model.value().get(0).review().name()); + Assertions.assertEquals("bfs", model.value().get(0).resourceWorkload().id()); + Assertions.assertEquals("nehmpvecx", model.value().get(0).resourceWorkload().name()); + Assertions.assertEquals("debfqkkrbmpukgri", model.value().get(0).sourceSystem()); + Assertions.assertEquals("lzlfbxzpuz", model.value().get(0).notes()); + Assertions.assertEquals("qzvszjf", model.nextLink()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationSavingsDetailsTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationSavingsDetailsTests.java new file mode 100644 index 0000000000000..f921a5d16c287 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationSavingsDetailsTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.ResourceRecommendationSavingsDetails; +import org.junit.jupiter.api.Assertions; + +public final class ResourceRecommendationSavingsDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourceRecommendationSavingsDetails model = BinaryData.fromString( + "{\"potentialSavings\":71.15996708841945,\"potentialSavingsInBillingCurrency\":1.602322055258032,\"wastedTillDate\":88.85056724851158,\"wastedTillDateInBillingCurrency\":35.39479137581388,\"realizedSavings\":87.51548324733915,\"realizedSavingsInBillingCurrency\":70.30389141004343}") + .toObject(ResourceRecommendationSavingsDetails.class); + Assertions.assertEquals(71.15996708841945D, model.potentialSavings()); + Assertions.assertEquals(1.602322055258032D, model.potentialSavingsInBillingCurrency()); + Assertions.assertEquals(88.85056724851158D, model.wastedTillDate()); + Assertions.assertEquals(35.39479137581388D, model.wastedTillDateInBillingCurrency()); + Assertions.assertEquals(87.51548324733915D, model.realizedSavings()); + Assertions.assertEquals(70.30389141004343D, model.realizedSavingsInBillingCurrency()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationSavingsTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationSavingsTests.java new file mode 100644 index 0000000000000..11b912af76fb8 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationSavingsTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.ResourceRecommendationSavings; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class ResourceRecommendationSavingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourceRecommendationSavings model = BinaryData.fromString( + "{\"providerCurrency\":\"vo\",\"billingCurrency\":\"ujjugwdkcglh\",\"isDirectChannel\":false,\"resourceDeletedOn\":\"2021-11-26T18:46:31Z\",\"retail\":{\"potentialSavings\":18.423533390882408,\"potentialSavingsInBillingCurrency\":92.68480143402465,\"wastedTillDate\":44.614759975354346,\"wastedTillDateInBillingCurrency\":70.4574917901251,\"realizedSavings\":66.20520747403593,\"realizedSavingsInBillingCurrency\":4.5198754721525125},\"contracted\":{\"potentialSavings\":74.37913406017509,\"potentialSavingsInBillingCurrency\":85.40872392029657,\"wastedTillDate\":34.07034779402972,\"wastedTillDateInBillingCurrency\":59.155171189425324,\"realizedSavings\":75.36955466194868,\"realizedSavingsInBillingCurrency\":3.4610325039401424}}") + .toObject(ResourceRecommendationSavings.class); + Assertions.assertEquals("vo", model.providerCurrency()); + Assertions.assertEquals("ujjugwdkcglh", model.billingCurrency()); + Assertions.assertFalse(model.isDirectChannel()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-26T18:46:31Z"), model.resourceDeletedOn()); + Assertions.assertEquals(18.423533390882408D, model.retail().potentialSavings()); + Assertions.assertEquals(92.68480143402465D, model.retail().potentialSavingsInBillingCurrency()); + Assertions.assertEquals(44.614759975354346D, model.retail().wastedTillDate()); + Assertions.assertEquals(70.4574917901251D, model.retail().wastedTillDateInBillingCurrency()); + Assertions.assertEquals(66.20520747403593D, model.retail().realizedSavings()); + Assertions.assertEquals(4.5198754721525125D, model.retail().realizedSavingsInBillingCurrency()); + Assertions.assertEquals(74.37913406017509D, model.contracted().potentialSavings()); + Assertions.assertEquals(85.40872392029657D, model.contracted().potentialSavingsInBillingCurrency()); + Assertions.assertEquals(34.07034779402972D, model.contracted().wastedTillDate()); + Assertions.assertEquals(59.155171189425324D, model.contracted().wastedTillDateInBillingCurrency()); + Assertions.assertEquals(75.36955466194868D, model.contracted().realizedSavings()); + Assertions.assertEquals(3.4610325039401424D, model.contracted().realizedSavingsInBillingCurrency()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ScoreEntityTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ScoreEntityTests.java new file mode 100644 index 0000000000000..d9ee3829107ad --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ScoreEntityTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.ScoreEntity; +import org.junit.jupiter.api.Assertions; + +public final class ScoreEntityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ScoreEntity model = BinaryData.fromString( + "{\"date\":\"mwmbes\",\"score\":24.57484606762269,\"consumptionUnits\":88.84418680770835,\"impactedResourceCount\":58.46728739031367,\"potentialScoreIncrease\":26.38806206888773,\"categoryCount\":29.06893015991301}") + .toObject(ScoreEntity.class); + Assertions.assertEquals("mwmbes", model.date()); + Assertions.assertEquals(24.57484606762269D, model.score()); + Assertions.assertEquals(88.84418680770835D, model.consumptionUnits()); + Assertions.assertEquals(58.46728739031367D, model.impactedResourceCount()); + Assertions.assertEquals(26.38806206888773D, model.potentialScoreIncrease()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ShortDescriptionTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ShortDescriptionTests.java index 9a5716f927679..b1fdf0b9cfa57 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ShortDescriptionTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ShortDescriptionTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -11,17 +11,9 @@ public final class ShortDescriptionTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - ShortDescription model - = BinaryData.fromString("{\"problem\":\"rbirphxe\",\"solution\":\"yva\"}").toObject(ShortDescription.class); - Assertions.assertEquals("rbirphxe", model.problem()); - Assertions.assertEquals("yva", model.solution()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ShortDescription model = new ShortDescription().withProblem("rbirphxe").withSolution("yva"); - model = BinaryData.fromObject(model).toObject(ShortDescription.class); - Assertions.assertEquals("rbirphxe", model.problem()); - Assertions.assertEquals("yva", model.solution()); + ShortDescription model = BinaryData.fromString("{\"problem\":\"aagdfmg\",\"solution\":\"lhjxr\"}") + .toObject(ShortDescription.class); + Assertions.assertEquals("aagdfmg", model.problem()); + Assertions.assertEquals("lhjxr", model.solution()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionContractInnerTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionContractInnerTests.java index 5238bdc8b670c..346580bb303d4 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionContractInnerTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionContractInnerTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -12,18 +12,17 @@ public final class SuppressionContractInnerTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { SuppressionContractInner model = BinaryData.fromString( - "{\"properties\":{\"suppressionId\":\"mkfssxqukkfplgm\",\"ttl\":\"xnkjzkdesl\",\"expirationTimeStamp\":\"2021-02-28T10:36:53Z\"},\"id\":\"opwi\",\"name\":\"ighxpk\",\"type\":\"wzbaiue\"}") + "{\"properties\":{\"suppressionId\":\"j\",\"ttl\":\"xxivetv\",\"expirationTimeStamp\":\"2021-02-03T22:58:32Z\"},\"id\":\"qtdo\",\"name\":\"mcbxvwvxysl\",\"type\":\"bhsfxob\"}") .toObject(SuppressionContractInner.class); - Assertions.assertEquals("mkfssxqukkfplgm", model.suppressionId()); - Assertions.assertEquals("xnkjzkdesl", model.ttl()); + Assertions.assertEquals("j", model.suppressionId()); + Assertions.assertEquals("xxivetv", model.ttl()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - SuppressionContractInner model - = new SuppressionContractInner().withSuppressionId("mkfssxqukkfplgm").withTtl("xnkjzkdesl"); + SuppressionContractInner model = new SuppressionContractInner().withSuppressionId("j").withTtl("xxivetv"); model = BinaryData.fromObject(model).toObject(SuppressionContractInner.class); - Assertions.assertEquals("mkfssxqukkfplgm", model.suppressionId()); - Assertions.assertEquals("xnkjzkdesl", model.ttl()); + Assertions.assertEquals("j", model.suppressionId()); + Assertions.assertEquals("xxivetv", model.ttl()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionContractListResultTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionContractListResultTests.java index 4f816aefa4a0f..545d9b29e67a6 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionContractListResultTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionContractListResultTests.java @@ -1,35 +1,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.fluent.models.SuppressionContractInner; -import com.azure.resourcemanager.advisor.models.SuppressionContractListResult; -import java.util.Arrays; +import com.azure.resourcemanager.advisor.implementation.models.SuppressionContractListResult; import org.junit.jupiter.api.Assertions; public final class SuppressionContractListResultTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { SuppressionContractListResult model = BinaryData.fromString( - "{\"nextLink\":\"xpsiebtfhvpes\",\"value\":[{\"properties\":{\"suppressionId\":\"dqmh\",\"ttl\":\"dhtldwkyz\",\"expirationTimeStamp\":\"2021-08-29T07:48:34Z\"},\"id\":\"tkncwsc\",\"name\":\"svlxotogtwrup\",\"type\":\"sx\"},{\"properties\":{\"suppressionId\":\"i\",\"ttl\":\"kvceoveilovnotyf\",\"expirationTimeStamp\":\"2021-11-08T07:56:07Z\"},\"id\":\"njbkcnxdhbttkph\",\"name\":\"wpn\",\"type\":\"jtoqne\"},{\"properties\":{\"suppressionId\":\"lfplp\",\"ttl\":\"xus\",\"expirationTimeStamp\":\"2021-02-26T20:34:01Z\"},\"id\":\"abgy\",\"name\":\"psbjta\",\"type\":\"qugxywpmueefjzwf\"}]}") + "{\"value\":[{\"properties\":{\"suppressionId\":\"hxcr\",\"ttl\":\"fovasr\",\"expirationTimeStamp\":\"2021-11-24T07:21:32Z\"},\"id\":\"bhsqfsubcgjbirxb\",\"name\":\"ybsrfbjfdtwss\",\"type\":\"t\"}],\"nextLink\":\"pvjzbe\"}") .toObject(SuppressionContractListResult.class); - Assertions.assertEquals("xpsiebtfhvpes", model.nextLink()); - Assertions.assertEquals("dqmh", model.value().get(0).suppressionId()); - Assertions.assertEquals("dhtldwkyz", model.value().get(0).ttl()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SuppressionContractListResult model = new SuppressionContractListResult().withNextLink("xpsiebtfhvpes") - .withValue(Arrays.asList(new SuppressionContractInner().withSuppressionId("dqmh").withTtl("dhtldwkyz"), - new SuppressionContractInner().withSuppressionId("i").withTtl("kvceoveilovnotyf"), - new SuppressionContractInner().withSuppressionId("lfplp").withTtl("xus"))); - model = BinaryData.fromObject(model).toObject(SuppressionContractListResult.class); - Assertions.assertEquals("xpsiebtfhvpes", model.nextLink()); - Assertions.assertEquals("dqmh", model.value().get(0).suppressionId()); - Assertions.assertEquals("dhtldwkyz", model.value().get(0).ttl()); + Assertions.assertEquals("hxcr", model.value().get(0).suppressionId()); + Assertions.assertEquals("fovasr", model.value().get(0).ttl()); + Assertions.assertEquals("pvjzbe", model.nextLink()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionPropertiesTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionPropertiesTests.java index 133bc8dd94295..a55b6fc151dca 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionPropertiesTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionPropertiesTests.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; @@ -12,17 +12,17 @@ public final class SuppressionPropertiesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { SuppressionProperties model = BinaryData.fromString( - "{\"suppressionId\":\"a\",\"ttl\":\"nyqupedeojnabck\",\"expirationTimeStamp\":\"2021-08-06T08:04:06Z\"}") + "{\"suppressionId\":\"tkblmpewww\",\"ttl\":\"krvrns\",\"expirationTimeStamp\":\"2021-09-18T19:23:36Z\"}") .toObject(SuppressionProperties.class); - Assertions.assertEquals("a", model.suppressionId()); - Assertions.assertEquals("nyqupedeojnabck", model.ttl()); + Assertions.assertEquals("tkblmpewww", model.suppressionId()); + Assertions.assertEquals("krvrns", model.ttl()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - SuppressionProperties model = new SuppressionProperties().withSuppressionId("a").withTtl("nyqupedeojnabck"); + SuppressionProperties model = new SuppressionProperties().withSuppressionId("tkblmpewww").withTtl("krvrns"); model = BinaryData.fromObject(model).toObject(SuppressionProperties.class); - Assertions.assertEquals("a", model.suppressionId()); - Assertions.assertEquals("nyqupedeojnabck", model.ttl()); + Assertions.assertEquals("tkblmpewww", model.suppressionId()); + Assertions.assertEquals("krvrns", model.ttl()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsCreateWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsCreateWithResponseMockTests.java index 27d47be61e963..b08ed6ab3c4c9 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsCreateWithResponseMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsCreateWithResponseMockTests.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.models.SuppressionContract; @@ -21,23 +21,23 @@ public final class SuppressionsCreateWithResponseMockTests { @Test public void testCreateWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"suppressionId\":\"ooaojkniodkooebw\",\"ttl\":\"jhemms\",\"expirationTimeStamp\":\"2021-07-03T07:44:33Z\"},\"id\":\"kcrodtjinfw\",\"name\":\"lfltka\",\"type\":\"jvefkdlfoakggkfp\"}"; + = "{\"properties\":{\"suppressionId\":\"vruzslzojhpctfnm\",\"ttl\":\"otngfdgu\",\"expirationTimeStamp\":\"2021-11-04T18:23Z\"},\"id\":\"i\",\"name\":\"grkyuizabsnmfpph\",\"type\":\"jee\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); SuppressionContract response = manager.suppressions() - .define("r") - .withExistingRecommendation("brqubp", "xhexiilivpdti") - .withSuppressionId("qoaxoruzfgs") - .withTtl("yfxrx") + .define("jjrcgegydc") + .withExistingRecommendation("qspkcdqzhlctd", "unqndyfpchrqb") + .withSuppressionId("xjumvq") + .withTtl("lihrraiouaubr") .create(); - Assertions.assertEquals("ooaojkniodkooebw", response.suppressionId()); - Assertions.assertEquals("jhemms", response.ttl()); + Assertions.assertEquals("vruzslzojhpctfnm", response.suppressionId()); + Assertions.assertEquals("otngfdgu", response.ttl()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsDeleteWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsDeleteWithResponseMockTests.java index 12d05a20e8c90..2dce431535824 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsDeleteWithResponseMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsDeleteWithResponseMockTests.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import java.nio.charset.StandardCharsets; @@ -25,10 +25,10 @@ public void testDeleteWithResponse() throws Exception { AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); manager.suppressions() - .deleteWithResponse("sofwqmzqalkrmnji", "pxacqqudfn", "yxbaaabjyvayf", com.azure.core.util.Context.NONE); + .deleteWithResponse("tlwexxwlalniexz", "rzpgep", "tybbwwpgda", com.azure.core.util.Context.NONE); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsGetWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsGetWithResponseMockTests.java index 39726da509e2f..b28dabf23cbd9 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsGetWithResponseMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsGetWithResponseMockTests.java @@ -1,13 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.models.SuppressionContract; @@ -21,20 +21,20 @@ public final class SuppressionsGetWithResponseMockTests { @Test public void testGetWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"suppressionId\":\"mjsjqb\",\"ttl\":\"hyxxrwlycoduhpk\",\"expirationTimeStamp\":\"2021-05-16T10:11:32Z\"},\"id\":\"ymareqnajxqugj\",\"name\":\"ky\",\"type\":\"ubeddg\"}"; + = "{\"properties\":{\"suppressionId\":\"cqpbtuo\",\"ttl\":\"eszabbelawumuas\",\"expirationTimeStamp\":\"2021-02-28T06:26:09Z\"},\"id\":\"rrwoycqucwyhahn\",\"name\":\"mdr\",\"type\":\"ywuhpsvfuur\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); SuppressionContract response = manager.suppressions() - .getWithResponse("fatpxllrxcyjmoa", "su", "arm", com.azure.core.util.Context.NONE) + .getWithResponse("chxgs", "boldforobwj", "vizbfhfo", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("mjsjqb", response.suppressionId()); - Assertions.assertEquals("hyxxrwlycoduhpk", response.ttl()); + Assertions.assertEquals("cqpbtuo", response.suppressionId()); + Assertions.assertEquals("eszabbelawumuas", response.ttl()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsListMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsListMockTests.java index 8bc477a361f43..4a5247186224f 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsListMockTests.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsListMockTests.java @@ -1,14 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.resourcemanager.advisor.generated; import com.azure.core.credential.AccessToken; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; import com.azure.core.test.http.MockHttpResponse; import com.azure.resourcemanager.advisor.AdvisorManager; import com.azure.resourcemanager.advisor.models.SuppressionContract; @@ -22,19 +22,19 @@ public final class SuppressionsListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"suppressionId\":\"tuzqogsexne\",\"ttl\":\"dnw\",\"expirationTimeStamp\":\"2021-06-10T08:53:24Z\"},\"id\":\"ewzsyyceuzsoib\",\"name\":\"ud\",\"type\":\"frxtrthzvaytdwk\"}]}"; + = "{\"value\":[{\"properties\":{\"suppressionId\":\"bn\",\"ttl\":\"ysux\",\"expirationTimeStamp\":\"2021-04-13T13:18:48Z\"},\"id\":\"ntvlwijpsttexo\",\"name\":\"qpwcyyufmh\",\"type\":\"uncuw\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); AdvisorManager manager = AdvisorManager.configure() .withHttpClient(httpClient) .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); PagedIterable response - = manager.suppressions().list(662894219, "m", com.azure.core.util.Context.NONE); + = manager.suppressions().list(993307689, "hzyvlixqnrkcx", com.azure.core.util.Context.NONE); - Assertions.assertEquals("tuzqogsexne", response.iterator().next().suppressionId()); - Assertions.assertEquals("dnw", response.iterator().next().ttl()); + Assertions.assertEquals("bn", response.iterator().next().suppressionId()); + Assertions.assertEquals("ysux", response.iterator().next().ttl()); } } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/TimeSeriesEntityTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/TimeSeriesEntityTests.java new file mode 100644 index 0000000000000..9c4c1755b4b37 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/TimeSeriesEntityTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.Aggregated; +import com.azure.resourcemanager.advisor.models.TimeSeriesEntity; +import org.junit.jupiter.api.Assertions; + +public final class TimeSeriesEntityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TimeSeriesEntity model = BinaryData.fromString( + "{\"aggregationLevel\":\"week\",\"scoreHistory\":[{\"date\":\"z\",\"score\":92.21938649142393,\"consumptionUnits\":46.45543688403541,\"impactedResourceCount\":77.8306918150323,\"potentialScoreIncrease\":96.20942380801813,\"categoryCount\":27.373082953956008}]}") + .toObject(TimeSeriesEntity.class); + Assertions.assertEquals(Aggregated.WEEK, model.aggregationLevel()); + Assertions.assertEquals("z", model.scoreHistory().get(0).date()); + Assertions.assertEquals(92.21938649142393D, model.scoreHistory().get(0).score()); + Assertions.assertEquals(46.45543688403541D, model.scoreHistory().get(0).consumptionUnits()); + Assertions.assertEquals(77.8306918150323D, model.scoreHistory().get(0).impactedResourceCount()); + Assertions.assertEquals(96.20942380801813D, model.scoreHistory().get(0).potentialScoreIncrease()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/TrackedRecommendationPropertiesTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/TrackedRecommendationPropertiesTests.java new file mode 100644 index 0000000000000..f5757fc7c50dc --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/TrackedRecommendationPropertiesTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.models.Priority; +import com.azure.resourcemanager.advisor.models.TrackedRecommendationProperties; +import org.junit.jupiter.api.Assertions; + +public final class TrackedRecommendationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TrackedRecommendationProperties model + = BinaryData.fromString("{\"priority\":\"Low\"}").toObject(TrackedRecommendationProperties.class); + Assertions.assertEquals(Priority.LOW, model.priority()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadListResultTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadListResultTests.java new file mode 100644 index 0000000000000..361268d5baa54 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadListResultTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.implementation.models.WorkloadListResult; +import org.junit.jupiter.api.Assertions; + +public final class WorkloadListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkloadListResult model = BinaryData.fromString( + "{\"value\":[{\"id\":\"yodnwzxltj\",\"name\":\"nhltiugcxn\",\"subscriptionId\":\"vwxqibyqunyo\",\"subscriptionName\":\"wlmdjrkv\"}],\"nextLink\":\"bvfvpdbod\"}") + .toObject(WorkloadListResult.class); + Assertions.assertEquals("yodnwzxltj", model.value().get(0).id()); + Assertions.assertEquals("nhltiugcxn", model.value().get(0).name()); + Assertions.assertEquals("vwxqibyqunyo", model.value().get(0).subscriptionId()); + Assertions.assertEquals("wlmdjrkv", model.value().get(0).subscriptionName()); + Assertions.assertEquals("bvfvpdbod", model.nextLink()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadResultInnerTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadResultInnerTests.java new file mode 100644 index 0000000000000..28f908fee4f06 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadResultInnerTests.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.advisor.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.advisor.fluent.models.WorkloadResultInner; +import org.junit.jupiter.api.Assertions; + +public final class WorkloadResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkloadResultInner model = BinaryData.fromString( + "{\"id\":\"izsjqlhkrr\",\"name\":\"deibqip\",\"subscriptionId\":\"ghvxndzwmkrefa\",\"subscriptionName\":\"jorwkqnyhgbij\"}") + .toObject(WorkloadResultInner.class); + Assertions.assertEquals("izsjqlhkrr", model.id()); + Assertions.assertEquals("deibqip", model.name()); + Assertions.assertEquals("ghvxndzwmkrefa", model.subscriptionId()); + Assertions.assertEquals("jorwkqnyhgbij", model.subscriptionName()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadsListMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadsListMockTests.java new file mode 100644 index 0000000000000..145dfb630d2e7 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/WorkloadsListMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.advisor.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.advisor.AdvisorManager; +import com.azure.resourcemanager.advisor.models.WorkloadResult; +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 WorkloadsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"id\":\"xcjxgrytfmpcy\",\"name\":\"lrmcaykg\",\"subscriptionId\":\"oxuztrksx\",\"subscriptionName\":\"ndfcpfn\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AdvisorManager manager = AdvisorManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.workloads().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("xcjxgrytfmpcy", response.iterator().next().id()); + Assertions.assertEquals("lrmcaykg", response.iterator().next().name()); + Assertions.assertEquals("oxuztrksx", response.iterator().next().subscriptionId()); + Assertions.assertEquals("ndfcpfn", response.iterator().next().subscriptionName()); + } +} diff --git a/sdk/advisor/azure-resourcemanager-advisor/tsp-location.yaml b/sdk/advisor/azure-resourcemanager-advisor/tsp-location.yaml new file mode 100644 index 0000000000000..e9f192dfc9a7f --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/advisor/resource-manager/Microsoft.Advisor/Advisor +commit: 2f40414843c3098af00f7a2773c139d67363ce75 +repo: Azure/azure-rest-api-specs +additionalDirectories: From 1970ca9550dc60b3bc904b7d91548394ba429abe Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Tue, 13 Oct 2026 01:46:09 +0000 Subject: [PATCH 2/3] Configurations: 'specification/advisor/resource-manager/Microsoft.Advisor/Advisor/tspconfig.yaml', and CommitSHA: 'fa7ed78f689a39d050007c9dd15eba7764a458b5' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6948232 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../CHANGELOG.md | 75 +++++++++---------- .../models/SuppressionContractInner.java | 8 +- .../fluent/models/SuppressionProperties.java | 12 +-- .../SuppressionContractImpl.java | 4 +- .../advisor/models/SuppressionContract.java | 6 +- ...zure-resourcemanager-advisor_metadata.json | 2 +- .../tsp-location.yaml | 2 +- 7 files changed, 52 insertions(+), 57 deletions(-) diff --git a/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md b/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md index 660d88d1de2a9..2ebf1250ee452 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md +++ b/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.1.0-beta.1 (2026-10-12) +## 1.1.0-beta.1 (2026-10-13) - Azure Resource Manager Advisor client library for Java. This package contains Microsoft Azure SDK for Advisor Management SDK. REST APIs for Azure Advisor Resiliency Reviews. Package api-version 2026-08-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). @@ -19,19 +19,19 @@ #### `models.ResourceMetadata` was modified * `ResourceMetadata()` was changed to private access +* `withPlural(java.lang.String)` was removed * `withResourceId(java.lang.String)` was removed -* `validate()` was removed * `withSource(java.lang.String)` was removed -* `withAction(java.util.Map)` was removed * `withSingular(java.lang.String)` was removed -* `withPlural(java.lang.String)` was removed +* `validate()` was removed +* `withAction(java.util.Map)` was removed #### `models.MetadataSupportedValueDetail` was modified * `MetadataSupportedValueDetail()` was changed to private access -* `withId(java.lang.String)` was removed * `validate()` was removed * `withDisplayName(java.lang.String)` was removed +* `withId(java.lang.String)` was removed #### `models.Recommendations` was modified @@ -42,23 +42,19 @@ #### `models.OperationDisplayInfo` was modified * `OperationDisplayInfo()` was changed to private access +* `withProvider(java.lang.String)` was removed * `validate()` was removed -* `withDescription(java.lang.String)` was removed -* `withResource(java.lang.String)` was removed * `withOperation(java.lang.String)` was removed -* `withProvider(java.lang.String)` was removed +* `withResource(java.lang.String)` was removed +* `withDescription(java.lang.String)` was removed #### `models.ShortDescription` was modified * `ShortDescription()` was changed to private access -* `validate()` was removed * `withProblem(java.lang.String)` was removed +* `validate()` was removed * `withSolution(java.lang.String)` was removed -#### `models.SuppressionContract` was modified - -* `expirationTimestamp()` was removed - #### `models.DigestConfig` was modified * `validate()` was removed @@ -73,10 +69,10 @@ #### `models.RecommendationsGenerateHeaders` was modified -* `withRetryAfter(java.lang.String)` was removed -* `validate()` was removed -* `java.lang.String retryAfter()` -> `java.lang.Integer retryAfter()` * `withLocation(java.lang.String)` was removed +* `java.lang.String retryAfter()` -> `java.lang.Integer retryAfter()` +* `validate()` was removed +* `withRetryAfter(java.lang.String)` was removed ### Features Added @@ -164,18 +160,18 @@ #### `models.Recommendations` was modified * `updateByServiceGroup(java.lang.String,java.lang.String,models.RecommendationPatchPayload)` was added -* `updateByServiceGroupWithResponse(java.lang.String,java.lang.String,models.RecommendationPatchPayload,com.azure.core.util.Context)` was added -* `list(java.lang.String,models.RecommendationListMode,java.lang.Integer,java.lang.String,com.azure.core.util.Context)` was added +* `listByTenant(java.lang.String,java.lang.String,java.lang.Integer,java.lang.String,com.azure.core.util.Context)` was added * `getGenerateStatus(java.lang.String)` was added * `listByServiceGroup(java.lang.String)` was added -* `update(java.lang.String,models.RecommendationPatchPayload)` was added +* `getGenerateStatusWithResponse(java.lang.String,com.azure.core.util.Context)` was added +* `list(java.lang.String,models.RecommendationListMode,java.lang.Integer,java.lang.String,com.azure.core.util.Context)` was added +* `updateWithResponse(java.lang.String,models.RecommendationPatchPayload,com.azure.core.util.Context)` was added * `getByServiceGroup(java.lang.String,java.lang.String)` was added +* `listByServiceGroup(java.lang.String,java.lang.String,models.RecommendationListMode,java.lang.Integer,java.lang.String,com.azure.core.util.Context)` was added +* `update(java.lang.String,models.RecommendationPatchPayload)` was added +* `updateByServiceGroupWithResponse(java.lang.String,java.lang.String,models.RecommendationPatchPayload,com.azure.core.util.Context)` was added * `listByTenant(java.lang.String)` was added -* `listByTenant(java.lang.String,java.lang.String,java.lang.Integer,java.lang.String,com.azure.core.util.Context)` was added -* `updateWithResponse(java.lang.String,models.RecommendationPatchPayload,com.azure.core.util.Context)` was added * `getByServiceGroupWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added -* `listByServiceGroup(java.lang.String,java.lang.String,models.RecommendationListMode,java.lang.Integer,java.lang.String,com.azure.core.util.Context)` was added -* `getGenerateStatusWithResponse(java.lang.String,com.azure.core.util.Context)` was added #### `models.ConfigData$Definition` was modified @@ -183,40 +179,39 @@ #### `AdvisorManager` was modified -* `advisorScores()` was added -* `resiliencyReviews()` was added -* `workloads()` was added * `assessments()` was added +* `workloads()` was added * `resourceProviders()` was added +* `advisorScores()` was added * `assessmentTypes()` was added +* `resiliencyReviews()` was added #### `models.SuppressionContract` was modified -* `expirationTimeStamp()` was added * `systemData()` was added #### `models.ResourceRecommendationBase` was modified -* `suppressionId()` was added -* `serviceGroupId()` was added -* `recommendationStatus()` was added -* `scoreChangedAt()` was added -* `resourceWorkload()` was added * `risk()` was added -* `systemData()` was added -* `criticalityScore()` was added +* `trackedProperties()` was added * `completionType()` was added -* `notes()` was added +* `postponedUntilDateTime()` was added +* `scoreChangedAt()` was added +* `lastRefreshed()` was added +* `systemData()` was added * `savings()` was added -* `createdTime()` was added -* `control()` was added -* `trackedProperties()` was added +* `notes()` was added +* `criticalityScore()` was added +* `resourceWorkload()` was added +* `serviceGroupId()` was added +* `recommendationStatus()` was added * `criticality()` was added -* `lastRefreshed()` was added * `recommendationDismissReason()` was added -* `postponedUntilDateTime()` was added * `review()` was added * `sourceSystem()` was added +* `control()` was added +* `suppressionId()` was added +* `createdTime()` was added #### `models.RecommendationMetadatas` was modified diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionContractInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionContractInner.java index f6202050f04ce..24a983252d18a 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionContractInner.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionContractInner.java @@ -144,12 +144,12 @@ public SuppressionContractInner withTtl(String ttl) { } /** - * Get the expirationTimeStamp property: Gets or sets the expiration time stamp. + * Get the expirationTimestamp property: Gets or sets the expiration time stamp. * - * @return the expirationTimeStamp value. + * @return the expirationTimestamp value. */ - public OffsetDateTime expirationTimeStamp() { - return this.innerProperties() == null ? null : this.innerProperties().expirationTimeStamp(); + public OffsetDateTime expirationTimestamp() { + return this.innerProperties() == null ? null : this.innerProperties().expirationTimestamp(); } /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionProperties.java index d38c778b19263..86d1f5c2ed888 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionProperties.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionProperties.java @@ -31,7 +31,7 @@ public final class SuppressionProperties implements JsonSerializable CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else { reader.skipChildren(); diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java index 18f06cae203e4..f92046cb80ffa 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java @@ -45,8 +45,8 @@ public String ttl() { return this.innerModel().ttl(); } - public OffsetDateTime expirationTimeStamp() { - return this.innerModel().expirationTimeStamp(); + public OffsetDateTime expirationTimestamp() { + return this.innerModel().expirationTimestamp(); } public SuppressionContractInner innerModel() { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/SuppressionContract.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/SuppressionContract.java index 996e7612c8ce6..8a150e35a88a1 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/SuppressionContract.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/SuppressionContract.java @@ -56,11 +56,11 @@ public interface SuppressionContract { String ttl(); /** - * Gets the expirationTimeStamp property: Gets or sets the expiration time stamp. + * Gets the expirationTimestamp property: Gets or sets the expiration time stamp. * - * @return the expirationTimeStamp value. + * @return the expirationTimestamp value. */ - OffsetDateTime expirationTimeStamp(); + OffsetDateTime expirationTimestamp(); /** * Gets the inner com.azure.resourcemanager.advisor.fluent.models.SuppressionContractInner object. diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/azure-resourcemanager-advisor_metadata.json b/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/azure-resourcemanager-advisor_metadata.json index 8517000c10860..e533649c9f22d 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/azure-resourcemanager-advisor_metadata.json +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/resources/META-INF/azure-resourcemanager-advisor_metadata.json @@ -1 +1 @@ -{"flavor":"azure","apiVersions":{"Microsoft.Advisor":"2026-08-01-preview"},"crossLanguagePackageId":"Microsoft.Advisor","crossLanguageVersion":"9a5b662d75e4","crossLanguageDefinitions":{"com.azure.resourcemanager.advisor.fluent.AdvisorManagementClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient.get":"Microsoft.Advisor.AdvisorScoreEntities.get","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient.getWithResponse":"Microsoft.Advisor.AdvisorScoreEntities.get","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient.list":"Microsoft.Advisor.AdvisorScoreEntities.list","com.azure.resourcemanager.advisor.fluent.AssessmentTypesClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AssessmentTypesClient.list":"Microsoft.Advisor.AssessmentTypesOperationGroup.list","com.azure.resourcemanager.advisor.fluent.AssessmentsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.delete":"Microsoft.Advisor.AssessmentResults.delete","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.deleteWithResponse":"Microsoft.Advisor.AssessmentResults.delete","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.get":"Microsoft.Advisor.AssessmentResults.get","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.getWithResponse":"Microsoft.Advisor.AssessmentResults.get","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.list":"Microsoft.Advisor.AssessmentResults.list","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.put":"Microsoft.Advisor.AssessmentResults.put","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.putWithResponse":"Microsoft.Advisor.AssessmentResults.put","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInResourceGroup":"Microsoft.Advisor.ConfigurationsOperationGroup.createInResourceGroup","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInResourceGroupWithResponse":"Microsoft.Advisor.ConfigurationsOperationGroup.createInResourceGroup","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInSubscription":"Microsoft.Advisor.ConfigurationsOperationGroup.createInSubscription","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInSubscriptionWithResponse":"Microsoft.Advisor.ConfigurationsOperationGroup.createInSubscription","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.list":"Microsoft.Advisor.ConfigurationsOperationGroup.listBySubscription","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.listByResourceGroup":"Microsoft.Advisor.ConfigurationsOperationGroup.listByResourceGroup","com.azure.resourcemanager.advisor.fluent.OperationsClient":"Microsoft.Advisor.Operations","com.azure.resourcemanager.advisor.fluent.OperationsClient.list":"Azure.ResourceManager.Legacy.Operations.list","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient.get":"Microsoft.Advisor.MetadataEntities.get","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient.getWithResponse":"Microsoft.Advisor.MetadataEntities.get","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient.list":"Microsoft.Advisor.MetadataEntities.list","com.azure.resourcemanager.advisor.fluent.RecommendationsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.generate":"Microsoft.Advisor.RecommendationsOperationGroup.generate","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.generateWithResponse":"Microsoft.Advisor.RecommendationsOperationGroup.generate","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.get":"Microsoft.Advisor.ResourceRecommendationBases.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getByServiceGroup":"Microsoft.Advisor.ServiceGroupRecommendations.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getByServiceGroupWithResponse":"Microsoft.Advisor.ServiceGroupRecommendations.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getGenerateStatus":"Microsoft.Advisor.RecommendationsOperationGroup.getGenerateStatus","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getGenerateStatusWithResponse":"Microsoft.Advisor.RecommendationsOperationGroup.getGenerateStatus","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getWithResponse":"Microsoft.Advisor.ResourceRecommendationBases.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.list":"Microsoft.Advisor.ResourceRecommendationBases.list","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.listByServiceGroup":"Microsoft.Advisor.ServiceGroupRecommendations.list","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.listByTenant":"Microsoft.Advisor.ResourceRecommendationBases.listByTenant","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.update":"Microsoft.Advisor.ResourceRecommendationBases.update","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.updateByServiceGroup":"Microsoft.Advisor.ServiceGroupRecommendations.update","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.updateByServiceGroupWithResponse":"Microsoft.Advisor.ServiceGroupRecommendations.update","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.updateWithResponse":"Microsoft.Advisor.ResourceRecommendationBases.update","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient.get":"Microsoft.Advisor.ResiliencyReviews.get","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient.getWithResponse":"Microsoft.Advisor.ResiliencyReviews.get","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient.list":"Microsoft.Advisor.ResiliencyReviews.list","com.azure.resourcemanager.advisor.fluent.ResourceProvidersClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.ResourceProvidersClient.predict":"Microsoft.Advisor.predict","com.azure.resourcemanager.advisor.fluent.ResourceProvidersClient.predictWithResponse":"Microsoft.Advisor.predict","com.azure.resourcemanager.advisor.fluent.SuppressionsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.create":"Microsoft.Advisor.SuppressionContracts.create","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.createWithResponse":"Microsoft.Advisor.SuppressionContracts.create","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.delete":"Microsoft.Advisor.SuppressionContracts.delete","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.deleteWithResponse":"Microsoft.Advisor.SuppressionContracts.delete","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.get":"Microsoft.Advisor.SuppressionContracts.get","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.getWithResponse":"Microsoft.Advisor.SuppressionContracts.get","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.list":"Microsoft.Advisor.SuppressionsOperationGroup.list","com.azure.resourcemanager.advisor.fluent.WorkloadsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.WorkloadsClient.list":"Microsoft.Advisor.WorkloadsOperationGroup.list","com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner":"Microsoft.Advisor.AdvisorScoreEntity","com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityProperties":"Microsoft.Advisor.AdvisorScoreEntityProperties","com.azure.resourcemanager.advisor.fluent.models.AssessmentResultInner":"Microsoft.Advisor.AssessmentResult","com.azure.resourcemanager.advisor.fluent.models.AssessmentResultProperties":"Microsoft.Advisor.AssessmentResultProperties","com.azure.resourcemanager.advisor.fluent.models.AssessmentTypeResultInner":"Microsoft.Advisor.AssessmentTypeResult","com.azure.resourcemanager.advisor.fluent.models.ConfigDataInner":"Microsoft.Advisor.ConfigData","com.azure.resourcemanager.advisor.fluent.models.ConfigDataProperties":"Microsoft.Advisor.ConfigDataProperties","com.azure.resourcemanager.advisor.fluent.models.MetadataEntityInner":"Microsoft.Advisor.MetadataEntity","com.azure.resourcemanager.advisor.fluent.models.MetadataEntityProperties":"Microsoft.Advisor.MetadataEntityProperties","com.azure.resourcemanager.advisor.fluent.models.OperationEntityInner":"Microsoft.Advisor.OperationEntity","com.azure.resourcemanager.advisor.fluent.models.PredictionRequestProperties":"Microsoft.Advisor.PredictionRequestProperties","com.azure.resourcemanager.advisor.fluent.models.PredictionResponseInner":"Microsoft.Advisor.PredictionResponse","com.azure.resourcemanager.advisor.fluent.models.PredictionResponseProperties":"Microsoft.Advisor.PredictionResponseProperties","com.azure.resourcemanager.advisor.fluent.models.RecommendationProperties":"Microsoft.Advisor.RecommendationProperties","com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewInner":"Microsoft.Advisor.ResiliencyReview","com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewProperties":"Microsoft.Advisor.ResiliencyReviewProperties","com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner":"Microsoft.Advisor.ResourceRecommendationBase","com.azure.resourcemanager.advisor.fluent.models.SuppressionContractInner":"Microsoft.Advisor.SuppressionContract","com.azure.resourcemanager.advisor.fluent.models.SuppressionProperties":"Microsoft.Advisor.SuppressionProperties","com.azure.resourcemanager.advisor.fluent.models.WorkloadResultInner":"Microsoft.Advisor.WorkloadResult","com.azure.resourcemanager.advisor.implementation.AdvisorManagementClientBuilder":"Microsoft.Advisor","com.azure.resourcemanager.advisor.implementation.models.AdvisorScoreResponse":"Microsoft.Advisor.AdvisorScoreResponse","com.azure.resourcemanager.advisor.implementation.models.AssessmentListResult":"Microsoft.Advisor.AssessmentListResult","com.azure.resourcemanager.advisor.implementation.models.AssessmentTypeListResult":"Microsoft.Advisor.AssessmentTypeListResult","com.azure.resourcemanager.advisor.implementation.models.ConfigurationListResult":"Microsoft.Advisor.ConfigurationListResult","com.azure.resourcemanager.advisor.implementation.models.MetadataEntityListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.advisor.implementation.models.OperationEntityListResult":"Microsoft.Advisor.OperationEntityListResult","com.azure.resourcemanager.advisor.implementation.models.ResiliencyReviewCollection":"Microsoft.Advisor.ResiliencyReviewCollection","com.azure.resourcemanager.advisor.implementation.models.ResourceRecommendationBaseListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.advisor.implementation.models.SuppressionContractListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.advisor.implementation.models.WorkloadListResult":"Microsoft.Advisor.WorkloadListResult","com.azure.resourcemanager.advisor.models.Aggregated":"Microsoft.Advisor.Aggregated","com.azure.resourcemanager.advisor.models.Category":"Microsoft.Advisor.Category","com.azure.resourcemanager.advisor.models.ConfigurationName":"Microsoft.Advisor.ConfigurationName","com.azure.resourcemanager.advisor.models.Control":"Microsoft.Advisor.Control","com.azure.resourcemanager.advisor.models.CpuThreshold":"Microsoft.Advisor.CpuThreshold","com.azure.resourcemanager.advisor.models.DigestConfig":"Microsoft.Advisor.DigestConfig","com.azure.resourcemanager.advisor.models.DigestConfigState":"Microsoft.Advisor.DigestConfigState","com.azure.resourcemanager.advisor.models.DurationModel":"Microsoft.Advisor.Duration","com.azure.resourcemanager.advisor.models.Impact":"Microsoft.Advisor.Impact","com.azure.resourcemanager.advisor.models.MetadataSupportedValueDetail":"Microsoft.Advisor.MetadataSupportedValueDetail","com.azure.resourcemanager.advisor.models.OperationDisplayInfo":"Microsoft.Advisor.OperationDisplayInfo","com.azure.resourcemanager.advisor.models.PredictionRequest":"Microsoft.Advisor.PredictionRequest","com.azure.resourcemanager.advisor.models.PredictionType":"Microsoft.Advisor.PredictionType","com.azure.resourcemanager.advisor.models.Priority":"Microsoft.Advisor.Priority","com.azure.resourcemanager.advisor.models.RecommendationDismissReason":"Microsoft.Advisor.RecommendationDismissReason","com.azure.resourcemanager.advisor.models.RecommendationListMode":"Microsoft.Advisor.RecommendationListMode","com.azure.resourcemanager.advisor.models.RecommendationPatchPayload":"Microsoft.Advisor.RecommendationPatchPayload","com.azure.resourcemanager.advisor.models.RecommendationPropertiesResourceWorkload":"Microsoft.Advisor.RecommendationPropertiesResourceWorkload","com.azure.resourcemanager.advisor.models.RecommendationPropertiesReview":"Microsoft.Advisor.RecommendationPropertiesReview","com.azure.resourcemanager.advisor.models.RecommendationStatePropertiesPayload":"Microsoft.Advisor.RecommendationStatePropertiesPayload","com.azure.resourcemanager.advisor.models.RecommendationStatus":"Microsoft.Advisor.RecommendationStatus","com.azure.resourcemanager.advisor.models.RecommendationsGenerateHeaders":null,"com.azure.resourcemanager.advisor.models.RecommendationsGetGenerateStatusHeaders":null,"com.azure.resourcemanager.advisor.models.ResourceMetadata":"Microsoft.Advisor.ResourceMetadata","com.azure.resourcemanager.advisor.models.ResourceRecommendationSavings":"Microsoft.Advisor.ResourceRecommendationSavings","com.azure.resourcemanager.advisor.models.ResourceRecommendationSavingsDetails":"Microsoft.Advisor.ResourceRecommendationSavingsDetails","com.azure.resourcemanager.advisor.models.ReviewStatus":"Microsoft.Advisor.ReviewStatus","com.azure.resourcemanager.advisor.models.Risk":"Microsoft.Advisor.Risk","com.azure.resourcemanager.advisor.models.Scenario":"Microsoft.Advisor.Scenario","com.azure.resourcemanager.advisor.models.ScoreEntity":"Microsoft.Advisor.ScoreEntity","com.azure.resourcemanager.advisor.models.ShortDescription":"Microsoft.Advisor.ShortDescription","com.azure.resourcemanager.advisor.models.TimeSeriesEntity":"Microsoft.Advisor.TimeSeriesEntity","com.azure.resourcemanager.advisor.models.TrackedRecommendationProperties":"Microsoft.Advisor.TrackedRecommendationProperties"},"generatedFiles":["src/main/java/com/azure/resourcemanager/advisor/AdvisorManager.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorManagementClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorScoresClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentTypesClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/ConfigurationsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationMetadatasClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/ResiliencyReviewsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/ResourceProvidersClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/SuppressionsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/WorkloadsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentTypeResultInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/OperationEntityInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionRequestProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/RecommendationProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResourceRecommendationBaseInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionContractInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/WorkloadResultInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/advisor/fluent/package-info.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoreEntityImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentResultImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypeResultImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/MetadataEntityImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/OperationEntityImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/PredictionResponseImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceRecommendationBaseImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadResultImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/AdvisorScoreResponse.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentTypeListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/ConfigurationListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/MetadataEntityListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/OperationEntityListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResiliencyReviewCollection.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResourceRecommendationBaseListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/SuppressionContractListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/WorkloadListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/package-info.java","src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScores.java","src/main/java/com/azure/resourcemanager/advisor/models/Aggregated.java","src/main/java/com/azure/resourcemanager/advisor/models/AssessmentResult.java","src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypeResult.java","src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypes.java","src/main/java/com/azure/resourcemanager/advisor/models/Assessments.java","src/main/java/com/azure/resourcemanager/advisor/models/Category.java","src/main/java/com/azure/resourcemanager/advisor/models/ConfigData.java","src/main/java/com/azure/resourcemanager/advisor/models/ConfigurationName.java","src/main/java/com/azure/resourcemanager/advisor/models/Configurations.java","src/main/java/com/azure/resourcemanager/advisor/models/Control.java","src/main/java/com/azure/resourcemanager/advisor/models/CpuThreshold.java","src/main/java/com/azure/resourcemanager/advisor/models/DigestConfig.java","src/main/java/com/azure/resourcemanager/advisor/models/DigestConfigState.java","src/main/java/com/azure/resourcemanager/advisor/models/DurationModel.java","src/main/java/com/azure/resourcemanager/advisor/models/Impact.java","src/main/java/com/azure/resourcemanager/advisor/models/MetadataEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/MetadataSupportedValueDetail.java","src/main/java/com/azure/resourcemanager/advisor/models/OperationDisplayInfo.java","src/main/java/com/azure/resourcemanager/advisor/models/OperationEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/Operations.java","src/main/java/com/azure/resourcemanager/advisor/models/PredictionRequest.java","src/main/java/com/azure/resourcemanager/advisor/models/PredictionResponse.java","src/main/java/com/azure/resourcemanager/advisor/models/PredictionType.java","src/main/java/com/azure/resourcemanager/advisor/models/Priority.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationDismissReason.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationListMode.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationMetadatas.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPatchPayload.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesResourceWorkload.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesReview.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatePropertiesPayload.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatus.java","src/main/java/com/azure/resourcemanager/advisor/models/Recommendations.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateHeaders.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateResponse.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusHeaders.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusResponse.java","src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReview.java","src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReviews.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceMetadata.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceProviders.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationBase.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavings.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavingsDetails.java","src/main/java/com/azure/resourcemanager/advisor/models/ReviewStatus.java","src/main/java/com/azure/resourcemanager/advisor/models/Risk.java","src/main/java/com/azure/resourcemanager/advisor/models/Scenario.java","src/main/java/com/azure/resourcemanager/advisor/models/ScoreEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/ShortDescription.java","src/main/java/com/azure/resourcemanager/advisor/models/SuppressionContract.java","src/main/java/com/azure/resourcemanager/advisor/models/Suppressions.java","src/main/java/com/azure/resourcemanager/advisor/models/TimeSeriesEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/TrackedRecommendationProperties.java","src/main/java/com/azure/resourcemanager/advisor/models/WorkloadResult.java","src/main/java/com/azure/resourcemanager/advisor/models/Workloads.java","src/main/java/com/azure/resourcemanager/advisor/models/package-info.java","src/main/java/com/azure/resourcemanager/advisor/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file +{"flavor":"azure","apiVersions":{"Microsoft.Advisor":"2026-08-01-preview"},"crossLanguagePackageId":"Microsoft.Advisor","crossLanguageVersion":"bba1846e23b7","crossLanguageDefinitions":{"com.azure.resourcemanager.advisor.fluent.AdvisorManagementClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient.get":"Microsoft.Advisor.AdvisorScoreEntities.get","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient.getWithResponse":"Microsoft.Advisor.AdvisorScoreEntities.get","com.azure.resourcemanager.advisor.fluent.AdvisorScoresClient.list":"Microsoft.Advisor.AdvisorScoreEntities.list","com.azure.resourcemanager.advisor.fluent.AssessmentTypesClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AssessmentTypesClient.list":"Microsoft.Advisor.AssessmentTypesOperationGroup.list","com.azure.resourcemanager.advisor.fluent.AssessmentsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.delete":"Microsoft.Advisor.AssessmentResults.delete","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.deleteWithResponse":"Microsoft.Advisor.AssessmentResults.delete","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.get":"Microsoft.Advisor.AssessmentResults.get","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.getWithResponse":"Microsoft.Advisor.AssessmentResults.get","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.list":"Microsoft.Advisor.AssessmentResults.list","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.put":"Microsoft.Advisor.AssessmentResults.put","com.azure.resourcemanager.advisor.fluent.AssessmentsClient.putWithResponse":"Microsoft.Advisor.AssessmentResults.put","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInResourceGroup":"Microsoft.Advisor.ConfigurationsOperationGroup.createInResourceGroup","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInResourceGroupWithResponse":"Microsoft.Advisor.ConfigurationsOperationGroup.createInResourceGroup","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInSubscription":"Microsoft.Advisor.ConfigurationsOperationGroup.createInSubscription","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.createInSubscriptionWithResponse":"Microsoft.Advisor.ConfigurationsOperationGroup.createInSubscription","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.list":"Microsoft.Advisor.ConfigurationsOperationGroup.listBySubscription","com.azure.resourcemanager.advisor.fluent.ConfigurationsClient.listByResourceGroup":"Microsoft.Advisor.ConfigurationsOperationGroup.listByResourceGroup","com.azure.resourcemanager.advisor.fluent.OperationsClient":"Microsoft.Advisor.Operations","com.azure.resourcemanager.advisor.fluent.OperationsClient.list":"Azure.ResourceManager.Legacy.Operations.list","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient.get":"Microsoft.Advisor.MetadataEntities.get","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient.getWithResponse":"Microsoft.Advisor.MetadataEntities.get","com.azure.resourcemanager.advisor.fluent.RecommendationMetadatasClient.list":"Microsoft.Advisor.MetadataEntities.list","com.azure.resourcemanager.advisor.fluent.RecommendationsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.generate":"Microsoft.Advisor.RecommendationsOperationGroup.generate","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.generateWithResponse":"Microsoft.Advisor.RecommendationsOperationGroup.generate","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.get":"Microsoft.Advisor.ResourceRecommendationBases.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getByServiceGroup":"Microsoft.Advisor.ServiceGroupRecommendations.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getByServiceGroupWithResponse":"Microsoft.Advisor.ServiceGroupRecommendations.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getGenerateStatus":"Microsoft.Advisor.RecommendationsOperationGroup.getGenerateStatus","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getGenerateStatusWithResponse":"Microsoft.Advisor.RecommendationsOperationGroup.getGenerateStatus","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.getWithResponse":"Microsoft.Advisor.ResourceRecommendationBases.get","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.list":"Microsoft.Advisor.ResourceRecommendationBases.list","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.listByServiceGroup":"Microsoft.Advisor.ServiceGroupRecommendations.list","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.listByTenant":"Microsoft.Advisor.ResourceRecommendationBases.listByTenant","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.update":"Microsoft.Advisor.ResourceRecommendationBases.update","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.updateByServiceGroup":"Microsoft.Advisor.ServiceGroupRecommendations.update","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.updateByServiceGroupWithResponse":"Microsoft.Advisor.ServiceGroupRecommendations.update","com.azure.resourcemanager.advisor.fluent.RecommendationsClient.updateWithResponse":"Microsoft.Advisor.ResourceRecommendationBases.update","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient.get":"Microsoft.Advisor.ResiliencyReviews.get","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient.getWithResponse":"Microsoft.Advisor.ResiliencyReviews.get","com.azure.resourcemanager.advisor.fluent.ResiliencyReviewsClient.list":"Microsoft.Advisor.ResiliencyReviews.list","com.azure.resourcemanager.advisor.fluent.ResourceProvidersClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.ResourceProvidersClient.predict":"Microsoft.Advisor.predict","com.azure.resourcemanager.advisor.fluent.ResourceProvidersClient.predictWithResponse":"Microsoft.Advisor.predict","com.azure.resourcemanager.advisor.fluent.SuppressionsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.create":"Microsoft.Advisor.SuppressionContracts.create","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.createWithResponse":"Microsoft.Advisor.SuppressionContracts.create","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.delete":"Microsoft.Advisor.SuppressionContracts.delete","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.deleteWithResponse":"Microsoft.Advisor.SuppressionContracts.delete","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.get":"Microsoft.Advisor.SuppressionContracts.get","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.getWithResponse":"Microsoft.Advisor.SuppressionContracts.get","com.azure.resourcemanager.advisor.fluent.SuppressionsClient.list":"Microsoft.Advisor.SuppressionsOperationGroup.list","com.azure.resourcemanager.advisor.fluent.WorkloadsClient":"Microsoft.Advisor","com.azure.resourcemanager.advisor.fluent.WorkloadsClient.list":"Microsoft.Advisor.WorkloadsOperationGroup.list","com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner":"Microsoft.Advisor.AdvisorScoreEntity","com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityProperties":"Microsoft.Advisor.AdvisorScoreEntityProperties","com.azure.resourcemanager.advisor.fluent.models.AssessmentResultInner":"Microsoft.Advisor.AssessmentResult","com.azure.resourcemanager.advisor.fluent.models.AssessmentResultProperties":"Microsoft.Advisor.AssessmentResultProperties","com.azure.resourcemanager.advisor.fluent.models.AssessmentTypeResultInner":"Microsoft.Advisor.AssessmentTypeResult","com.azure.resourcemanager.advisor.fluent.models.ConfigDataInner":"Microsoft.Advisor.ConfigData","com.azure.resourcemanager.advisor.fluent.models.ConfigDataProperties":"Microsoft.Advisor.ConfigDataProperties","com.azure.resourcemanager.advisor.fluent.models.MetadataEntityInner":"Microsoft.Advisor.MetadataEntity","com.azure.resourcemanager.advisor.fluent.models.MetadataEntityProperties":"Microsoft.Advisor.MetadataEntityProperties","com.azure.resourcemanager.advisor.fluent.models.OperationEntityInner":"Microsoft.Advisor.OperationEntity","com.azure.resourcemanager.advisor.fluent.models.PredictionRequestProperties":"Microsoft.Advisor.PredictionRequestProperties","com.azure.resourcemanager.advisor.fluent.models.PredictionResponseInner":"Microsoft.Advisor.PredictionResponse","com.azure.resourcemanager.advisor.fluent.models.PredictionResponseProperties":"Microsoft.Advisor.PredictionResponseProperties","com.azure.resourcemanager.advisor.fluent.models.RecommendationProperties":"Microsoft.Advisor.RecommendationProperties","com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewInner":"Microsoft.Advisor.ResiliencyReview","com.azure.resourcemanager.advisor.fluent.models.ResiliencyReviewProperties":"Microsoft.Advisor.ResiliencyReviewProperties","com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner":"Microsoft.Advisor.ResourceRecommendationBase","com.azure.resourcemanager.advisor.fluent.models.SuppressionContractInner":"Microsoft.Advisor.SuppressionContract","com.azure.resourcemanager.advisor.fluent.models.SuppressionProperties":"Microsoft.Advisor.SuppressionProperties","com.azure.resourcemanager.advisor.fluent.models.WorkloadResultInner":"Microsoft.Advisor.WorkloadResult","com.azure.resourcemanager.advisor.implementation.AdvisorManagementClientBuilder":"Microsoft.Advisor","com.azure.resourcemanager.advisor.implementation.models.AdvisorScoreResponse":"Microsoft.Advisor.AdvisorScoreResponse","com.azure.resourcemanager.advisor.implementation.models.AssessmentListResult":"Microsoft.Advisor.AssessmentListResult","com.azure.resourcemanager.advisor.implementation.models.AssessmentTypeListResult":"Microsoft.Advisor.AssessmentTypeListResult","com.azure.resourcemanager.advisor.implementation.models.ConfigurationListResult":"Microsoft.Advisor.ConfigurationListResult","com.azure.resourcemanager.advisor.implementation.models.MetadataEntityListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.advisor.implementation.models.OperationEntityListResult":"Microsoft.Advisor.OperationEntityListResult","com.azure.resourcemanager.advisor.implementation.models.ResiliencyReviewCollection":"Microsoft.Advisor.ResiliencyReviewCollection","com.azure.resourcemanager.advisor.implementation.models.ResourceRecommendationBaseListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.advisor.implementation.models.SuppressionContractListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.advisor.implementation.models.WorkloadListResult":"Microsoft.Advisor.WorkloadListResult","com.azure.resourcemanager.advisor.models.Aggregated":"Microsoft.Advisor.Aggregated","com.azure.resourcemanager.advisor.models.Category":"Microsoft.Advisor.Category","com.azure.resourcemanager.advisor.models.ConfigurationName":"Microsoft.Advisor.ConfigurationName","com.azure.resourcemanager.advisor.models.Control":"Microsoft.Advisor.Control","com.azure.resourcemanager.advisor.models.CpuThreshold":"Microsoft.Advisor.CpuThreshold","com.azure.resourcemanager.advisor.models.DigestConfig":"Microsoft.Advisor.DigestConfig","com.azure.resourcemanager.advisor.models.DigestConfigState":"Microsoft.Advisor.DigestConfigState","com.azure.resourcemanager.advisor.models.DurationModel":"Microsoft.Advisor.Duration","com.azure.resourcemanager.advisor.models.Impact":"Microsoft.Advisor.Impact","com.azure.resourcemanager.advisor.models.MetadataSupportedValueDetail":"Microsoft.Advisor.MetadataSupportedValueDetail","com.azure.resourcemanager.advisor.models.OperationDisplayInfo":"Microsoft.Advisor.OperationDisplayInfo","com.azure.resourcemanager.advisor.models.PredictionRequest":"Microsoft.Advisor.PredictionRequest","com.azure.resourcemanager.advisor.models.PredictionType":"Microsoft.Advisor.PredictionType","com.azure.resourcemanager.advisor.models.Priority":"Microsoft.Advisor.Priority","com.azure.resourcemanager.advisor.models.RecommendationDismissReason":"Microsoft.Advisor.RecommendationDismissReason","com.azure.resourcemanager.advisor.models.RecommendationListMode":"Microsoft.Advisor.RecommendationListMode","com.azure.resourcemanager.advisor.models.RecommendationPatchPayload":"Microsoft.Advisor.RecommendationPatchPayload","com.azure.resourcemanager.advisor.models.RecommendationPropertiesResourceWorkload":"Microsoft.Advisor.RecommendationPropertiesResourceWorkload","com.azure.resourcemanager.advisor.models.RecommendationPropertiesReview":"Microsoft.Advisor.RecommendationPropertiesReview","com.azure.resourcemanager.advisor.models.RecommendationStatePropertiesPayload":"Microsoft.Advisor.RecommendationStatePropertiesPayload","com.azure.resourcemanager.advisor.models.RecommendationStatus":"Microsoft.Advisor.RecommendationStatus","com.azure.resourcemanager.advisor.models.RecommendationsGenerateHeaders":null,"com.azure.resourcemanager.advisor.models.RecommendationsGetGenerateStatusHeaders":null,"com.azure.resourcemanager.advisor.models.ResourceMetadata":"Microsoft.Advisor.ResourceMetadata","com.azure.resourcemanager.advisor.models.ResourceRecommendationSavings":"Microsoft.Advisor.ResourceRecommendationSavings","com.azure.resourcemanager.advisor.models.ResourceRecommendationSavingsDetails":"Microsoft.Advisor.ResourceRecommendationSavingsDetails","com.azure.resourcemanager.advisor.models.ReviewStatus":"Microsoft.Advisor.ReviewStatus","com.azure.resourcemanager.advisor.models.Risk":"Microsoft.Advisor.Risk","com.azure.resourcemanager.advisor.models.Scenario":"Microsoft.Advisor.Scenario","com.azure.resourcemanager.advisor.models.ScoreEntity":"Microsoft.Advisor.ScoreEntity","com.azure.resourcemanager.advisor.models.ShortDescription":"Microsoft.Advisor.ShortDescription","com.azure.resourcemanager.advisor.models.TimeSeriesEntity":"Microsoft.Advisor.TimeSeriesEntity","com.azure.resourcemanager.advisor.models.TrackedRecommendationProperties":"Microsoft.Advisor.TrackedRecommendationProperties"},"generatedFiles":["src/main/java/com/azure/resourcemanager/advisor/AdvisorManager.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorManagementClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AdvisorScoresClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentTypesClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/AssessmentsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/ConfigurationsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationMetadatasClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/RecommendationsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/ResiliencyReviewsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/ResourceProvidersClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/SuppressionsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/WorkloadsClient.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentResultProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/AssessmentTypeResultInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ConfigDataProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/MetadataEntityProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/OperationEntityInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionRequestProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/RecommendationProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResiliencyReviewProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/ResourceRecommendationBaseInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionContractInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/SuppressionProperties.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/WorkloadResultInner.java","src/main/java/com/azure/resourcemanager/advisor/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/advisor/fluent/package-info.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoreEntityImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentResultImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypeResultImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/MetadataEntityImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/OperationEntityImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/PredictionResponseImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceRecommendationBaseImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadResultImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsClientImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsImpl.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/AdvisorScoreResponse.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/AssessmentTypeListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/ConfigurationListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/MetadataEntityListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/OperationEntityListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResiliencyReviewCollection.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/ResourceRecommendationBaseListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/SuppressionContractListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/models/WorkloadListResult.java","src/main/java/com/azure/resourcemanager/advisor/implementation/package-info.java","src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScores.java","src/main/java/com/azure/resourcemanager/advisor/models/Aggregated.java","src/main/java/com/azure/resourcemanager/advisor/models/AssessmentResult.java","src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypeResult.java","src/main/java/com/azure/resourcemanager/advisor/models/AssessmentTypes.java","src/main/java/com/azure/resourcemanager/advisor/models/Assessments.java","src/main/java/com/azure/resourcemanager/advisor/models/Category.java","src/main/java/com/azure/resourcemanager/advisor/models/ConfigData.java","src/main/java/com/azure/resourcemanager/advisor/models/ConfigurationName.java","src/main/java/com/azure/resourcemanager/advisor/models/Configurations.java","src/main/java/com/azure/resourcemanager/advisor/models/Control.java","src/main/java/com/azure/resourcemanager/advisor/models/CpuThreshold.java","src/main/java/com/azure/resourcemanager/advisor/models/DigestConfig.java","src/main/java/com/azure/resourcemanager/advisor/models/DigestConfigState.java","src/main/java/com/azure/resourcemanager/advisor/models/DurationModel.java","src/main/java/com/azure/resourcemanager/advisor/models/Impact.java","src/main/java/com/azure/resourcemanager/advisor/models/MetadataEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/MetadataSupportedValueDetail.java","src/main/java/com/azure/resourcemanager/advisor/models/OperationDisplayInfo.java","src/main/java/com/azure/resourcemanager/advisor/models/OperationEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/Operations.java","src/main/java/com/azure/resourcemanager/advisor/models/PredictionRequest.java","src/main/java/com/azure/resourcemanager/advisor/models/PredictionResponse.java","src/main/java/com/azure/resourcemanager/advisor/models/PredictionType.java","src/main/java/com/azure/resourcemanager/advisor/models/Priority.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationDismissReason.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationListMode.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationMetadatas.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPatchPayload.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesResourceWorkload.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationPropertiesReview.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatePropertiesPayload.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationStatus.java","src/main/java/com/azure/resourcemanager/advisor/models/Recommendations.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateHeaders.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGenerateResponse.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusHeaders.java","src/main/java/com/azure/resourcemanager/advisor/models/RecommendationsGetGenerateStatusResponse.java","src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReview.java","src/main/java/com/azure/resourcemanager/advisor/models/ResiliencyReviews.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceMetadata.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceProviders.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationBase.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavings.java","src/main/java/com/azure/resourcemanager/advisor/models/ResourceRecommendationSavingsDetails.java","src/main/java/com/azure/resourcemanager/advisor/models/ReviewStatus.java","src/main/java/com/azure/resourcemanager/advisor/models/Risk.java","src/main/java/com/azure/resourcemanager/advisor/models/Scenario.java","src/main/java/com/azure/resourcemanager/advisor/models/ScoreEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/ShortDescription.java","src/main/java/com/azure/resourcemanager/advisor/models/SuppressionContract.java","src/main/java/com/azure/resourcemanager/advisor/models/Suppressions.java","src/main/java/com/azure/resourcemanager/advisor/models/TimeSeriesEntity.java","src/main/java/com/azure/resourcemanager/advisor/models/TrackedRecommendationProperties.java","src/main/java/com/azure/resourcemanager/advisor/models/WorkloadResult.java","src/main/java/com/azure/resourcemanager/advisor/models/Workloads.java","src/main/java/com/azure/resourcemanager/advisor/models/package-info.java","src/main/java/com/azure/resourcemanager/advisor/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/advisor/azure-resourcemanager-advisor/tsp-location.yaml b/sdk/advisor/azure-resourcemanager-advisor/tsp-location.yaml index e9f192dfc9a7f..f71b566ce1bfa 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/tsp-location.yaml +++ b/sdk/advisor/azure-resourcemanager-advisor/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/advisor/resource-manager/Microsoft.Advisor/Advisor -commit: 2f40414843c3098af00f7a2773c139d67363ce75 +commit: fa7ed78f689a39d050007c9dd15eba7764a458b5 repo: Azure/azure-rest-api-specs additionalDirectories: From 164dc248f75b96e173914d7a5dde66df026e7c18 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Wed, 25 Nov 2026 12:16:52 +0800 Subject: [PATCH 3/3] Regenerate management SDK with Java emitter 0.49.2 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 21414032-74cf-43a0-b7a5-6b4cb46e104f --- .../AdvisorManagementClientImpl.java | 42 ++- .../AdvisorScoresClientImpl.java | 47 +-- .../implementation/AdvisorScoresImpl.java | 3 +- .../implementation/AssessmentResultImpl.java | 16 +- .../AssessmentTypesClientImpl.java | 40 +-- .../implementation/AssessmentTypesImpl.java | 3 +- .../implementation/AssessmentsClientImpl.java | 98 +----- .../implementation/AssessmentsImpl.java | 36 +-- .../implementation/ConfigDataImpl.java | 18 +- .../ConfigurationsClientImpl.java | 124 +------- .../implementation/ConfigurationsImpl.java | 6 +- .../implementation/OperationsClientImpl.java | 32 +- .../implementation/OperationsImpl.java | 3 +- .../RecommendationMetadatasClientImpl.java | 69 +---- .../RecommendationsClientImpl.java | 292 ++---------------- .../implementation/RecommendationsImpl.java | 4 +- .../ResiliencyReviewsClientImpl.java | 73 +---- .../implementation/ResourceManagerUtils.java | 11 + .../ResourceProvidersClientImpl.java | 21 +- .../SuppressionContractImpl.java | 21 +- .../SuppressionsClientImpl.java | 124 +------- .../implementation/SuppressionsImpl.java | 100 +----- .../implementation/WorkloadsClientImpl.java | 40 +-- .../advisor/implementation/WorkloadsImpl.java | 3 +- 24 files changed, 204 insertions(+), 1022 deletions(-) diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java index 07bc470f422e8..8c86a82068c79 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java @@ -22,6 +22,7 @@ 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.PollResponse; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.core.util.serializer.SerializerAdapter; @@ -375,6 +376,24 @@ public SyncPoller, U> getLroResult(Response act defaultPollInterval, () -> activationResponse, context); } + /** + * Waits for completion and gets the final result, or throws an error. + * + * @param poller the synchronous poller. + * @param type of poll result. + * @param type of final result. + * @return the final result. + * @throws ManagementException if the long running operation fails. + */ + public U getLroFinalResultOrError(SyncPoller, U> poller) { + PollResponse> response = poller.waitForCompletion(); + ManagementException exception = getLroException(response.getStatus(), response.getValue()); + if (exception != null) { + throw exception; + } + return poller.getFinalResult(); + } + /** * Gets the final result, or an error, based on last async poll response. * @@ -384,17 +403,25 @@ public SyncPoller, U> getLroResult(Response act * @return the final result, or an error. */ public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { - if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + ManagementException exception = getLroException(response.getStatus(), response.getValue()); + if (exception != null) { + return Mono.error(exception); + } + return response.getFinalResult(); + } + + private ManagementException getLroException(LongRunningOperationStatus status, PollResult result) { + PollResult.Error lroError = result == null ? null : result.getError(); + if (status != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED || lroError != null) { 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(); + errorMessage = lroError.getMessage(); + String errorBody = lroError.getResponseBody(); if (errorBody != null) { // try to deserialize error body to ManagementError try { @@ -413,12 +440,11 @@ public Mono getLroFinalResultOrError(AsyncPollResponse, } if (managementError == null) { // fallback to default ManagementError - managementError = new ManagementError(response.getStatus().toString(), errorMessage); + managementError = new ManagementError(status.toString(), errorMessage); } - return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); - } else { - return response.getFinalResult(); + return new ManagementException(errorMessage, errorResponse, managementError); } + return null; } private static final class HttpResponseImpl extends HttpResponse { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java index 036f6a7fe50fe..1097ebb9833ce 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java @@ -127,16 +127,7 @@ private Mono getAsync(String name) { return getWithResponseAsync(name).flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Gets the advisor score. - * - * @param name The scope of Advisor score entity. - * @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 advisor score along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String name, Context context) { final String accept = "application/json"; @@ -144,15 +135,7 @@ public Response getWithResponse(String name, Context co name, accept, context); } - /** - * Gets the advisor score. - * - * @param name The scope of Advisor score entity. - * @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 advisor score. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public AdvisorScoreEntityInner get(String name) { return getWithResponse(name, Context.NONE).getValue(); @@ -197,11 +180,7 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listSinglePage() { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - null, null); + return listSinglePage(Context.NONE); } /** @@ -222,27 +201,13 @@ private PagedResponse listSinglePage(Context context) { null, null); } - /** - * Gets the list of advisor scores. - * - * @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 list of advisor scores as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(() -> listSinglePage()); + return list(Context.NONE); } - /** - * Gets the list of advisor scores. - * - * @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 list of advisor scores as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { return new PagedIterable<>(() -> listSinglePage(context)); diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.java index a8948004db8de..062396ab5da20 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.java @@ -43,8 +43,7 @@ public AdvisorScoreEntity get(String name) { } public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AdvisorScoreEntityImpl(inner1, this.manager())); + return this.list(Context.NONE); } public PagedIterable list(Context context) { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentResultImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentResultImpl.java index 81db2059e6d20..53427b6dd2dd0 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentResultImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentResultImpl.java @@ -82,11 +82,7 @@ private com.azure.resourcemanager.advisor.AdvisorManager manager() { private String assessmentName; public AssessmentResult create() { - this.innerObject = serviceManager.serviceClient() - .getAssessments() - .putWithResponse(assessmentName, this.innerModel(), Context.NONE) - .getValue(); - return this; + return this.create(Context.NONE); } public AssessmentResult create(Context context) { @@ -108,11 +104,7 @@ public AssessmentResultImpl update() { } public AssessmentResult apply() { - this.innerObject = serviceManager.serviceClient() - .getAssessments() - .putWithResponse(assessmentName, this.innerModel(), Context.NONE) - .getValue(); - return this; + return this.apply(Context.NONE); } public AssessmentResult apply(Context context) { @@ -133,9 +125,7 @@ public AssessmentResult apply(Context context) { } public AssessmentResult refresh() { - this.innerObject - = serviceManager.serviceClient().getAssessments().getWithResponse(assessmentName, Context.NONE).getValue(); - return this; + return this.refresh(Context.NONE); } public AssessmentResult refresh(Context context) { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesClientImpl.java index 52442485f8d72..ca7a45a845035 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesClientImpl.java @@ -146,11 +146,7 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listSinglePage() { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listSinglePage(Context.NONE); } /** @@ -175,35 +171,13 @@ private PagedResponse listSinglePage(Context context) res.getValue().nextLink(), null); } - /** - * Get assessment types list. - * - * Get list of Azure Advisor assessment types. - * - * @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 assessment types list. - * - * Get list of Azure Advisor assessment types as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + return list(Context.NONE); } - /** - * Get assessment types list. - * - * Get list of Azure Advisor assessment types. - * - * @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 assessment types list. - * - * Get list of Azure Advisor assessment types as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); @@ -247,11 +221,7 @@ private Mono> listNextSinglePageAsync(S */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listNextSinglePage(nextLink, Context.NONE); } /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesImpl.java index 11ea4cadaa49b..cced25cdcf686 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentTypesImpl.java @@ -26,8 +26,7 @@ public AssessmentTypesImpl(AssessmentTypesClient innerClient, } public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new AssessmentTypeResultImpl(inner1, this.manager())); + return this.list(Context.NONE); } public PagedIterable list(Context context) { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsClientImpl.java index 6c23fa10b9e8f..3eaa4b6e1911b 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsClientImpl.java @@ -181,16 +181,7 @@ private Mono getAsync(String assessmentName) { return getWithResponseAsync(assessmentName).flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Get an existing Azure Advisor assessment. - * - * @param assessmentName Advisor assessment 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 an existing Azure Advisor assessment along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String assessmentName, Context context) { final String accept = "application/json"; @@ -198,15 +189,7 @@ public Response getWithResponse(String assessmentName, Co assessmentName, accept, context); } - /** - * Get an existing Azure Advisor assessment. - * - * @param assessmentName Advisor assessment 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 an existing Azure Advisor assessment. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public AssessmentResultInner get(String assessmentName) { return getWithResponse(assessmentName, Context.NONE).getValue(); @@ -250,17 +233,7 @@ private Mono putAsync(String assessmentName, AssessmentRe .flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Create or Overwrite Azure Advisor assessment. - * - * @param assessmentName Advisor assessment name. - * @param assessmentContract The Azure Advisor assessment data structure. - * @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 Advisor assessment result data structure along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response putWithResponse(String assessmentName, AssessmentResultInner assessmentContract, Context context) { @@ -270,16 +243,7 @@ public Response putWithResponse(String assessmentName, assessmentName, contentType, accept, assessmentContract, context); } - /** - * Create or Overwrite Azure Advisor assessment. - * - * @param assessmentName Advisor assessment name. - * @param assessmentContract The Azure Advisor assessment data structure. - * @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 Advisor assessment result data structure. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public AssessmentResultInner put(String assessmentName, AssessmentResultInner assessmentContract) { return putWithResponse(assessmentName, assessmentContract, Context.NONE).getValue(); @@ -316,30 +280,14 @@ private Mono deleteAsync(String assessmentName) { return deleteWithResponseAsync(assessmentName).flatMap(ignored -> Mono.empty()); } - /** - * Delete an existing Azure Advisor assessment. - * - * @param assessmentName Advisor assessment 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}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String assessmentName, Context context) { return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), assessmentName, context); } - /** - * Delete an existing Azure Advisor assessment. - * - * @param assessmentName Advisor assessment 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. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String assessmentName) { deleteWithResponse(assessmentName, Context.NONE); @@ -410,11 +358,7 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listSinglePage(String top, String skiptoken) { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), top, skiptoken, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listSinglePage(top, skiptoken, Context.NONE); } /** @@ -437,31 +381,15 @@ private PagedResponse listSinglePage(String top, String s res.getValue().nextLink(), null); } - /** - * Get list of Azure Advisor assessments. - * - * @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 list of Azure Advisor assessments as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { final String top = null; final String skiptoken = null; - return new PagedIterable<>(() -> listSinglePage(top, skiptoken), nextLink -> listNextSinglePage(nextLink)); + return list(top, skiptoken, Context.NONE); } - /** - * Get list of Azure Advisor assessments. - * - * @param top Limit the result to the specified number of rows. - * @param skiptoken The page-continuation token to use with a paged version of this API. - * @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 list of Azure Advisor assessments as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String top, String skiptoken, Context context) { return new PagedIterable<>(() -> listSinglePage(top, skiptoken, context), @@ -498,11 +426,7 @@ private Mono> listNextSinglePageAsync(Strin */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listNextSinglePage(nextLink, Context.NONE); } /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsImpl.java index 36d8b1a02a64f..040db2d6b6242 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AssessmentsImpl.java @@ -47,7 +47,7 @@ public Response deleteWithResponse(String assessmentName, Context context) } public void delete(String assessmentName) { - this.serviceClient().delete(assessmentName); + this.deleteWithResponse(assessmentName, Context.NONE); } public PagedIterable list() { @@ -61,46 +61,24 @@ public PagedIterable list(String top, String skiptoken, Contex } public AssessmentResult getById(String id) { - String assessmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments/{assessmentName}", - "assessmentName"); - if (assessmentName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); - } - return this.getWithResponse(assessmentName, Context.NONE).getValue(); + return this.getByIdWithResponse(id, Context.NONE).getValue(); } public Response getByIdWithResponse(String id, Context context) { - String assessmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, + String assessmentName = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments/{assessmentName}", - "assessmentName"); - if (assessmentName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); - } + "assessmentName", "assessments", LOGGER); return this.getWithResponse(assessmentName, context); } public void deleteById(String id) { - String assessmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments/{assessmentName}", - "assessmentName"); - if (assessmentName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); - } - this.deleteWithResponse(assessmentName, Context.NONE); + this.deleteByIdWithResponse(id, Context.NONE); } public Response deleteByIdWithResponse(String id, Context context) { - String assessmentName = ResourceManagerUtils.getValueFromIdByParameterName(id, + String assessmentName = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/assessments/{assessmentName}", - "assessmentName"); - if (assessmentName == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'assessments'.", id))); - } + "assessmentName", "assessments", LOGGER); return this.deleteWithResponse(assessmentName, context); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java index 266cebf0d9453..b6f149341d2ef 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java @@ -23,6 +23,18 @@ public final class ConfigDataImpl implements ConfigData, ConfigData.Definition { ConfigDataImpl(ConfigDataInner innerObject, com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; + String configurationNameLocal = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}", + "configurationName"); + if (configurationNameLocal == null) { + configurationNameLocal = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations/{configurationName}", + "configurationName"); + } + this.configurationName = ConfigurationName.fromString(configurationNameLocal); + this.resourceGroup = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations/{configurationName}", + "resourceGroup"); } public String id() { @@ -80,11 +92,7 @@ public ConfigDataImpl withExistingResourceGroup(String resourceGroup) { } public ConfigData create() { - this.innerObject = serviceManager.serviceClient() - .getConfigurations() - .createInResourceGroupWithResponse(configurationName, resourceGroup, this.innerModel(), Context.NONE) - .getValue(); - return this; + return this.create(Context.NONE); } public ConfigData create(Context context) { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsClientImpl.java index 1322a81bc798f..f8e7a72de2201 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsClientImpl.java @@ -215,11 +215,7 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listSinglePage() { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listSinglePage(Context.NONE); } /** @@ -242,31 +238,13 @@ private PagedResponse listSinglePage(Context context) { res.getValue().nextLink(), null); } - /** - * Retrieve Azure Advisor configurations. - * - * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. - * - * @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 paged collection of ConfigData items as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + return list(Context.NONE); } - /** - * Retrieve Azure Advisor configurations. - * - * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. - * - * @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 paged collection of ConfigData items as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { return new PagedIterable<>(() -> listSinglePage(context), @@ -316,19 +294,7 @@ private Mono createInSubscriptionAsync(ConfigurationName config .flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Create/Overwrite Azure Advisor configuration. - * - * Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. - * - * @param configurationName Advisor configuration name. Value must be 'default'. - * @param configContract The Azure Advisor configuration data structure. - * @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 Advisor configuration data structure along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response createInSubscriptionWithResponse(ConfigurationName configurationName, ConfigDataInner configContract, Context context) { @@ -338,18 +304,7 @@ public Response createInSubscriptionWithResponse(ConfigurationN this.client.getSubscriptionId(), configurationName, contentType, accept, configContract, context); } - /** - * Create/Overwrite Azure Advisor configuration. - * - * Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. - * - * @param configurationName Advisor configuration name. Value must be 'default'. - * @param configContract The Azure Advisor configuration data structure. - * @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 Advisor configuration data structure. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public ConfigDataInner createInSubscription(ConfigurationName configurationName, ConfigDataInner configContract) { return createInSubscriptionWithResponse(configurationName, configContract, Context.NONE).getValue(); @@ -402,11 +357,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGroup */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listByResourceGroupSinglePage(String resourceGroup) { - final String accept = "application/json"; - Response res = service.listByResourceGroupSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroup, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listByResourceGroupSinglePage(resourceGroup, Context.NONE); } /** @@ -428,31 +379,13 @@ private PagedResponse listByResourceGroupSinglePage(String reso res.getValue().nextLink(), null); } - /** - * Retrieve Azure Advisor configurations. - * - * @param resourceGroup The name of the Azure resource group. - * @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 paged collection of ConfigData items as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroup) { - return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroup), - nextLink -> listByResourceGroupNextSinglePage(nextLink)); + return listByResourceGroup(resourceGroup, Context.NONE); } - /** - * Retrieve Azure Advisor configurations. - * - * @param resourceGroup The name of the Azure resource group. - * @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 paged collection of ConfigData items as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroup, Context context) { return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroup, context), @@ -501,18 +434,7 @@ private Mono createInResourceGroupAsync(ConfigurationName confi .flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Create/Overwrite Azure Advisor configuration. - * - * @param configurationName Advisor configuration name. Value must be 'default'. - * @param resourceGroup The name of the Azure resource group. - * @param configContract The Azure Advisor configuration data structure. - * @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 Advisor configuration data structure along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response createInResourceGroupWithResponse(ConfigurationName configurationName, String resourceGroup, ConfigDataInner configContract, Context context) { @@ -523,17 +445,7 @@ public Response createInResourceGroupWithResponse(Configuration context); } - /** - * Create/Overwrite Azure Advisor configuration. - * - * @param configurationName Advisor configuration name. Value must be 'default'. - * @param resourceGroup The name of the Azure resource group. - * @param configContract The Azure Advisor configuration data structure. - * @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 Advisor configuration data structure. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public ConfigDataInner createInResourceGroup(ConfigurationName configurationName, String resourceGroup, ConfigDataInner configContract) { @@ -577,11 +489,7 @@ private Mono> listBySubscriptionNextSinglePageAsy */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listBySubscriptionNextSinglePage(nextLink, Context.NONE); } /** @@ -641,11 +549,7 @@ private Mono> listByResourceGroupNextSinglePageAs */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listByResourceGroupNextSinglePage(nextLink, Context.NONE); } /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsImpl.java index 4826376d61935..9259378307ca3 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigurationsImpl.java @@ -29,8 +29,7 @@ public ConfigurationsImpl(ConfigurationsClient innerClient, } public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ConfigDataImpl(inner1, this.manager())); + return this.list(Context.NONE); } public PagedIterable list(Context context) { @@ -56,8 +55,7 @@ public ConfigData createInSubscription(ConfigurationName configurationName, Conf } public PagedIterable listByResourceGroup(String resourceGroup) { - PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroup); - return ResourceManagerUtils.mapPage(inner, inner1 -> new ConfigDataImpl(inner1, this.manager())); + return this.listByResourceGroup(resourceGroup, Context.NONE); } public PagedIterable listByResourceGroup(String resourceGroup, Context context) { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsClientImpl.java index dff3d6f1e044b..f6e021a7448fe 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsClientImpl.java @@ -132,11 +132,7 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listSinglePage() { - final String accept = "application/json"; - Response res - = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listSinglePage(Context.NONE); } /** @@ -157,27 +153,13 @@ private PagedResponse listSinglePage(Context context) { 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 paged collection of OperationEntity items as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + return list(Context.NONE); } - /** - * 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 paged collection of OperationEntity items as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); @@ -213,11 +195,7 @@ private Mono> listNextSinglePageAsync(String */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listNextSinglePage(nextLink, Context.NONE); } /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsImpl.java index 1cdd7626debad..89c056b574df8 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/OperationsImpl.java @@ -26,8 +26,7 @@ public OperationsImpl(OperationsClient innerClient, } public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationEntityImpl(inner1, this.manager())); + return this.list(Context.NONE); } public PagedIterable list(Context context) { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasClientImpl.java index 8ace9830393aa..218a04cc71e56 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationMetadatasClientImpl.java @@ -146,33 +146,14 @@ private Mono getAsync(String name) { return getWithResponseAsync(name).flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Gets the metadata entity. - * - * @param name Name of metadata entity. - * @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 ManagementException thrown if the request is rejected by server on status code 404. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the metadata entity along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String name, Context context) { final String accept = "application/json"; return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), name, accept, context); } - /** - * Gets the metadata entity. - * - * @param name Name of metadata entity. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws ManagementException thrown if the request is rejected by server on status code 404. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the metadata entity. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public MetadataEntityInner get(String name) { return getWithResponse(name, Context.NONE).getValue(); @@ -274,11 +255,7 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listSinglePage(String filter) { - final String accept = "application/json"; - Response res - = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), filter, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listSinglePage(filter, Context.NONE); } /** @@ -313,42 +290,14 @@ private PagedResponse listSinglePage(String filter, Context res.getValue().nextLink(), null); } - /** - * Gets the list of metadata entities. - * - * @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 list of metadata entities as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { final String filter = null; - return new PagedIterable<>(() -> listSinglePage(filter), nextLink -> listNextSinglePage(nextLink)); + return list(filter, Context.NONE); } - /** - * Gets the list of metadata entities. - * - * @param filter The filter to apply to the recommendation metadata.<br>Filter can be applied to properties - * ['[recommendationCategory](#category)', '[recommendationSubCategory](#recommendationSubCategory)', - * 'RetirementDate'] with operators ['eq', 'and', 'le', 'ge']<br>The filter can also be applied to property - * ['[TrackingIds]']<br><br>âš  **Note:** `recommendationControl` is a legacy filter property and will be - * deprecated in the future. Please use `recommendationSubCategory` for filtering recommendation - * subcategory.<br><br>Valid options for recommendationSubCategory: ['BusinessContinuity', - * 'DisasterRecovery', 'HighAvailability', 'MonitoringAndAlerting', 'Other', 'Personalized', - * 'PrioritizedRecommendations', 'Scalability', 'ServiceUpgradeAndRetirement', - * 'Validation']<br><br>Example:<br>- $filter=recommendationCategory eq 'HighAvailability' and - * recommendationSubCategory eq 'ServiceUpgradeAndRetirement' and retirementDate ge '2024-01-01' and retirementDate - * le '2028-01-01'. Filter can be applied on trackingIds as well.<br>- $filter=trackingIds/any(t: t eq - * 'some-guid')<br><br>âš  **Note:** `trackingIDs` filter can be used for filtering one value at a time. - * The support to filter multiple values is not currently available. Also the support to add other filters along - * with `trackingIDs` is not available. - * @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 list of metadata entities as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String filter, Context context) { return new PagedIterable<>(() -> listSinglePage(filter, context), @@ -384,11 +333,7 @@ private Mono> listNextSinglePageAsync(String */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listNextSinglePage(nextLink, Context.NONE); } /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsClientImpl.java index 02fd9bc0ab528..dc316bfac0b82 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsClientImpl.java @@ -319,17 +319,7 @@ private Mono getAsync(String resourceUri, Strin return getWithResponseAsync(resourceUri, recommendationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Obtains details of a cached recommendation. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param recommendationId The recommendation ID. - * @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 advisor Recommendation along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceUri, String recommendationId, Context context) { @@ -338,16 +328,7 @@ public Response getWithResponse(String resource accept, context); } - /** - * Obtains details of a cached recommendation. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param recommendationId The recommendation ID. - * @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 advisor Recommendation. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public ResourceRecommendationBaseInner get(String resourceUri, String recommendationId) { return getWithResponse(resourceUri, recommendationId, Context.NONE).getValue(); @@ -390,17 +371,7 @@ private Mono updateAsync(String recommendationI return updateWithResponseAsync(recommendationId, properties).flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Update the state of a Recommendation. - * - * @param recommendationId The recommendation ID. - * @param properties The resource properties to be updated. - * @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 advisor Recommendation along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response updateWithResponse(String recommendationId, RecommendationPatchPayload properties, Context context) { @@ -410,16 +381,7 @@ public Response updateWithResponse(String recom this.client.getSubscriptionId(), recommendationId, contentType, accept, properties, context); } - /** - * Update the state of a Recommendation. - * - * @param recommendationId The recommendation ID. - * @param properties The resource properties to be updated. - * @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 advisor Recommendation. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public ResourceRecommendationBaseInner update(String recommendationId, RecommendationPatchPayload properties) { return updateWithResponse(recommendationId, properties, Context.NONE).getValue(); @@ -543,12 +505,7 @@ private PagedFlux listAsync() { @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listSinglePage(String filter, RecommendationListMode mode, Integer top, String skipToken) { - final String accept = "application/json"; - Response res - = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), - filter, mode, top, skipToken, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listSinglePage(filter, mode, top, skipToken, Context.NONE); } /** @@ -589,52 +546,17 @@ private PagedResponse listSinglePage(String fil res.getValue().nextLink(), null); } - /** - * Obtains recommendations for a subscription. - * - * @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 ResourceRecommendationBase list operation as paginated response with - * {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { final String filter = null; final RecommendationListMode mode = null; final Integer top = null; final String skipToken = null; - return new PagedIterable<>(() -> listSinglePage(filter, mode, top, skipToken), - nextLink -> listNextSinglePage(nextLink)); + return list(filter, mode, top, skipToken, Context.NONE); } - /** - * Obtains recommendations for a subscription. - * - * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties - * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', - * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', - * 'or', 'lt', 'gt', 'le', 'ge']<br>. - * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use - * `SubCategory` for filtering recommendation subcategory.<br> - * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and - * onwards.<br> - * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> - * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', - * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', - * 'ServiceUpgradeAndRetirement', 'Validation']<br> - * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq - * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le - * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'Critical'. - * @param mode The recommendation retrieval mode. - * @param top The number of recommendations per page if a paged version of this API is being used. - * @param skipToken The page-continuation token to use with a paged version of this API. - * @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 ResourceRecommendationBase list operation as paginated response with - * {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String filter, RecommendationListMode mode, Integer top, String skipToken, Context context) { @@ -729,11 +651,7 @@ private PagedFlux listByTenantAsync(String reso @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listByTenantSinglePage(String resourceUri, String filter, Integer top, String skipToken) { - final String accept = "application/json"; - Response res = service.listByTenantSync(this.client.getEndpoint(), - this.client.getApiVersion(), resourceUri, filter, top, skipToken, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listByTenantSinglePage(resourceUri, filter, top, skipToken, Context.NONE); } /** @@ -762,43 +680,16 @@ private PagedResponse listByTenantSinglePage(St res.getValue().nextLink(), null); } - /** - * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking - * generateRecommendations. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response of a ResourceRecommendationBase list operation as paginated response with - * {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByTenant(String resourceUri) { final String filter = null; final Integer top = null; final String skipToken = null; - return new PagedIterable<>(() -> listByTenantSinglePage(resourceUri, filter, top, skipToken), - nextLink -> listByTenantNextSinglePage(nextLink)); + return listByTenant(resourceUri, filter, top, skipToken, Context.NONE); } - /** - * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking - * generateRecommendations. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties - * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)'] with operators ['eq', 'and', - * 'or'].<br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq 'MyResourceGroup'. - * @param top The number of recommendations per page if a paged version of this API is being used. - * @param skipToken The page-continuation token to use with a paged version of this API. - * @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 ResourceRecommendationBase list operation as paginated response with - * {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByTenant(String resourceUri, String filter, Integer top, String skipToken, Context context) { @@ -929,11 +820,7 @@ private PagedFlux listByServiceGroupAsync(Strin @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listByServiceGroupSinglePage(String serviceGroupName, String filter, RecommendationListMode mode, Integer top, String skipToken) { - final String accept = "application/json"; - Response res = service.listByServiceGroupSync(this.client.getEndpoint(), - this.client.getApiVersion(), serviceGroupName, filter, mode, top, skipToken, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listByServiceGroupSinglePage(serviceGroupName, filter, mode, top, skipToken, Context.NONE); } /** @@ -974,55 +861,17 @@ private PagedResponse listByServiceGroupSingleP res.getValue().nextLink(), null); } - /** - * Obtains recommendations for a service group. - * - * @param serviceGroupName The name of the service group. - * @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 ResourceRecommendationBase list operation as paginated response with - * {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServiceGroup(String serviceGroupName) { final String filter = null; final RecommendationListMode mode = null; final Integer top = null; final String skipToken = null; - return new PagedIterable<>(() -> listByServiceGroupSinglePage(serviceGroupName, filter, mode, top, skipToken), - nextLink -> listByServiceGroupNextSinglePage(nextLink)); + return listByServiceGroup(serviceGroupName, filter, mode, top, skipToken, Context.NONE); } - /** - * Obtains recommendations for a service group. - * - * @param serviceGroupName The name of the service group. - * @param filter The filter to apply to the recommendations.<br>Filter can be applied to properties - * ['ResourceId', 'ResourceGroup', 'RecommendationTypeGuid', '[Category](#category)', 'SubCategory', - * 'RetirementDate', '[RecommendationStatus](#recommendationStatus)', 'Criticality'] with operators ['eq', 'and', - * 'or', 'lt', 'gt', 'le', 'ge']<br>. - * <br>**Note:** `Control` is a legacy filter property and will be deprecated in the future. Please use - * `SubCategory` for filtering recommendation subcategory.<br> - * <br>**Note:** `RecommendationStatus` filter is available from API Version 2026-02-01-preview and - * onwards.<br> - * <br>**Note:** `Criticality` filter is available from API Version 2026-08-01-preview and onwards.<br> - * <br>Valid options for SubCategory:<br>['BusinessContinuity', 'DisasterRecovery', 'HighAvailability', - * 'MonitoringAndAlerting', 'Other', 'Personalized', 'PrioritizedRecommendations', 'Scalability', - * 'ServiceUpgradeAndRetirement', 'Validation']<br> - * <br>Example:<br>- $filter=Category eq 'Cost' and ResourceGroup eq - * 'MyResourceGroup'<br>-$filter=SubCategory eq 'ServiceUpgradeAndRetirement' and RetirementDate le - * '2028-01-01' and RetirementDate ge '2024-01-01'<br>-$filter=Criticality eq 'High'. - * @param mode The recommendation retrieval mode. - * @param top The number of recommendations per page. - * @param skipToken The page-continuation token for the next page. - * @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 ResourceRecommendationBase list operation as paginated response with - * {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServiceGroup(String serviceGroupName, String filter, RecommendationListMode mode, Integer top, String skipToken, Context context) { @@ -1068,17 +917,7 @@ private Mono getByServiceGroupAsync(String serv .flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Obtains details of a recommendation for a service group. - * - * @param serviceGroupName The name of the service group. - * @param recommendationId The recommendation ID. - * @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 advisor Recommendation along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response getByServiceGroupWithResponse(String serviceGroupName, String recommendationId, Context context) { @@ -1087,16 +926,7 @@ public Response getByServiceGroupWithResponse(S recommendationId, accept, context); } - /** - * Obtains details of a recommendation for a service group. - * - * @param serviceGroupName The name of the service group. - * @param recommendationId The recommendation ID. - * @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 advisor Recommendation. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public ResourceRecommendationBaseInner getByServiceGroup(String serviceGroupName, String recommendationId) { return getByServiceGroupWithResponse(serviceGroupName, recommendationId, Context.NONE).getValue(); @@ -1142,18 +972,7 @@ private Mono updateByServiceGroupAsync(String s .flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Updates the state of a recommendation for a service group. - * - * @param serviceGroupName The name of the service group. - * @param recommendationId The recommendation ID. - * @param properties The resource properties to be updated. - * @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 advisor Recommendation along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response updateByServiceGroupWithResponse(String serviceGroupName, String recommendationId, RecommendationPatchPayload properties, Context context) { @@ -1163,17 +982,7 @@ public Response updateByServiceGroupWithRespons serviceGroupName, recommendationId, contentType, accept, properties, context); } - /** - * Updates the state of a recommendation for a service group. - * - * @param serviceGroupName The name of the service group. - * @param recommendationId The recommendation ID. - * @param properties The resource properties to be updated. - * @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 advisor Recommendation. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public ResourceRecommendationBaseInner updateByServiceGroup(String serviceGroupName, String recommendationId, RecommendationPatchPayload properties) { @@ -1210,29 +1019,14 @@ private Mono generateAsync() { return generateWithResponseAsync().flatMap(ignored -> Mono.empty()); } - /** - * Initiates the recommendation generation or computation process for a subscription. This operation is - * asynchronous. The generated recommendations are stored in a cache in the Advisor service. - * - * @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. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public RecommendationsGenerateResponse generateWithResponse(Context context) { return service.generateSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), context); } - /** - * Initiates the recommendation generation or computation process for a subscription. This operation is - * asynchronous. The generated recommendations are stored in a cache in the Advisor service. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public void generate() { generateWithResponse(Context.NONE); @@ -1273,34 +1067,14 @@ private Mono getGenerateStatusAsync(String operationId) { return getGenerateStatusWithResponseAsync(operationId).flatMap(ignored -> Mono.empty()); } - /** - * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the - * generation recommendation. The URI of this API is returned in the Location field of the response header. - * - * @param operationId The operation ID, which can be found from the Location field in the generate recommendation - * response header. - * @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. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public RecommendationsGetGenerateStatusResponse getGenerateStatusWithResponse(String operationId, Context context) { return service.getGenerateStatusSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), operationId, context); } - /** - * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the - * generation recommendation. The URI of this API is returned in the Location field of the response header. - * - * @param operationId The operation ID, which can be found from the Location field in the generate recommendation - * response header. - * @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. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public void getGenerateStatus(String operationId) { getGenerateStatusWithResponse(operationId, Context.NONE); @@ -1336,11 +1110,7 @@ private Mono> listNextSinglePageA */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listNextSinglePage(nextLink, Context.NONE); } /** @@ -1393,11 +1163,7 @@ private Mono> listByTenantNextSin */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listByTenantNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByTenantNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listByTenantNextSinglePage(nextLink, Context.NONE); } /** @@ -1453,11 +1219,7 @@ private PagedResponse listByTenantNextSinglePag */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listByServiceGroupNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listByServiceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listByServiceGroupNextSinglePage(nextLink, Context.NONE); } /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsImpl.java index b296e0c0b31e3..da8a21e7c59bf 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/RecommendationsImpl.java @@ -150,7 +150,7 @@ public RecommendationsGenerateResponse generateWithResponse(Context context) { } public void generate() { - this.serviceClient().generate(); + this.generateWithResponse(Context.NONE); } public RecommendationsGetGenerateStatusResponse getGenerateStatusWithResponse(String operationId, Context context) { @@ -158,7 +158,7 @@ public RecommendationsGetGenerateStatusResponse getGenerateStatusWithResponse(St } public void getGenerateStatus(String operationId) { - this.serviceClient().getGenerateStatus(operationId); + this.getGenerateStatusWithResponse(operationId, Context.NONE); } private RecommendationsClient serviceClient() { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsClientImpl.java index ad8da8d8ff8b5..bcf91c9aeb3b9 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResiliencyReviewsClientImpl.java @@ -154,20 +154,7 @@ private Mono getAsync(String reviewId) { return getWithResponseAsync(reviewId).flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Get existing resiliency review. - * - * Get existing Azure Advisor resiliency review by id. - * - * @param reviewId Existing review id. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - * @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 existing resiliency review. - * - * Get existing Azure Advisor resiliency review by id along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String reviewId, Context context) { final String accept = "application/json"; @@ -175,19 +162,7 @@ public Response getWithResponse(String reviewId, Context reviewId, accept, context); } - /** - * Get existing resiliency review. - * - * Get existing Azure Advisor resiliency review by id. - * - * @param reviewId Existing review id. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). - * @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 existing resiliency review. - * - * Get existing Azure Advisor resiliency review by id. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public ResiliencyReviewInner get(String reviewId) { return getWithResponse(reviewId, Context.NONE).getValue(); @@ -281,11 +256,7 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listSinglePage(Integer top, Integer skip, String filter) { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), top, skip, filter, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listSinglePage(top, skip, filter, Context.NONE); } /** @@ -315,42 +286,16 @@ private PagedResponse listSinglePage(Integer top, Integer res.getValue().nextLink(), null); } - /** - * Get list of resiliency reviews. - * - * Get list of Azure Advisor resiliency reviews. - * - * @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 list of resiliency reviews. - * - * Get list of Azure Advisor resiliency reviews as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { final Integer top = null; final Integer skip = null; final String filter = null; - return new PagedIterable<>(() -> listSinglePage(top, skip, filter), nextLink -> listNextSinglePage(nextLink)); + return list(top, skip, filter, Context.NONE); } - /** - * Get list of resiliency reviews. - * - * Get list of Azure Advisor resiliency reviews. - * - * @param top The number of items to be included in the result. - * @param skip The number of items to skip before starting to collect the result set. - * @param filter The filter to apply.<br>Filter can be applied to properties ['reviewStatus', 'reviewId'] with - * operators ['eq', 'and', 'or'].<br>Example:<br>- $filter=reviewStatus eq 'New'. - * @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 list of resiliency reviews. - * - * Get list of Azure Advisor resiliency reviews as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Integer top, Integer skip, String filter, Context context) { return new PagedIterable<>(() -> listSinglePage(top, skip, filter, context), @@ -395,11 +340,7 @@ private Mono> listNextSinglePageAsync(Strin */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listNextSinglePage(nextLink, Context.NONE); } /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceManagerUtils.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceManagerUtils.java index 2747fab148be5..c68e64c639938 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceManagerUtils.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceManagerUtils.java @@ -8,6 +8,7 @@ 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.logging.ClientLogger; import java.util.Arrays; import java.util.Iterator; import java.util.function.Function; @@ -58,6 +59,16 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri return idIndex < idStart ? value : null; } + static String getRequiredValueFromIdByParameterName(String id, String pathTemplate, String parameterName, + String segmentName, ClientLogger logger) { + String value = getValueFromIdByParameterName(id, pathTemplate, parameterName); + if (value == null) { + throw logger.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment '%s'.", id, segmentName))); + } + return value; + } + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { return new PagedIterableImpl<>(pageIterable, mapper); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java index 47b337c9cdbd9..56479f9439ba8 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java @@ -108,16 +108,7 @@ private Mono predictAsync(PredictionRequest predictionR return predictWithResponseAsync(predictionRequest).flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Predicts a recommendation. - * - * @param predictionRequest The request body. - * @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 response used by predictions along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response predictWithResponse(PredictionRequest predictionRequest, Context context) { final String contentType = "application/json"; @@ -126,15 +117,7 @@ public Response predictWithResponse(PredictionRequest p this.client.getSubscriptionId(), contentType, accept, predictionRequest, context); } - /** - * Predicts a recommendation. - * - * @param predictionRequest The request body. - * @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 response used by predictions. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public PredictionResponseInner predict(PredictionRequest predictionRequest) { return predictWithResponse(predictionRequest, Context.NONE).getValue(); diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java index f92046cb80ffa..00330a803d110 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionContractImpl.java @@ -19,6 +19,15 @@ public final class SuppressionContractImpl implements SuppressionContract, Suppr com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; + this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", + "resourceUri"); + this.recommendationId = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", + "recommendationId"); + this.name = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", + "name"); } public String id() { @@ -70,11 +79,7 @@ public SuppressionContractImpl withExistingRecommendation(String resourceUri, St } public SuppressionContract create() { - this.innerObject = serviceManager.serviceClient() - .getSuppressions() - .createWithResponse(resourceUri, recommendationId, name, this.innerModel(), Context.NONE) - .getValue(); - return this; + return this.create(Context.NONE); } public SuppressionContract create(Context context) { @@ -92,11 +97,7 @@ public SuppressionContract create(Context context) { } public SuppressionContract refresh() { - this.innerObject = serviceManager.serviceClient() - .getSuppressions() - .getWithResponse(resourceUri, recommendationId, name, Context.NONE) - .getValue(); - return this; + return this.refresh(Context.NONE); } public SuppressionContract refresh(Context context) { diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java index 6b33abaf85feb..313a0545673a0 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsClientImpl.java @@ -203,20 +203,7 @@ private Mono getAsync(String resourceUri, String recom .flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Obtains the details of a suppression. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param recommendationId The recommendation ID. - * @param name The name of the suppression. - * @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 ManagementException thrown if the request is rejected by server on status code 404. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with - * the rule along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String resourceUri, String recommendationId, String name, Context context) { @@ -225,19 +212,7 @@ public Response getWithResponse(String resourceUri, St name, accept, context); } - /** - * Obtains the details of a suppression. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param recommendationId The recommendation ID. - * @param name The name of the suppression. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws ManagementException thrown if the request is rejected by server on status code 404. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with - * the rule. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public SuppressionContractInner get(String resourceUri, String recommendationId, String name) { return getWithResponse(resourceUri, recommendationId, name, Context.NONE).getValue(); @@ -291,22 +266,7 @@ private Mono createAsync(String resourceUri, String re .flatMap(res -> Mono.justOrEmpty(res.getValue())); } - /** - * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to - * as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param recommendationId The recommendation ID. - * @param name The name of the suppression. - * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. - * @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 ManagementException thrown if the request is rejected by server on status code 404. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with - * the rule along with {@link Response}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response createWithResponse(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract, Context context) { @@ -316,21 +276,7 @@ public Response createWithResponse(String resourceUri, name, contentType, accept, suppressionContract, context); } - /** - * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to - * as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param recommendationId The recommendation ID. - * @param name The name of the suppression. - * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws ManagementException thrown if the request is rejected by server on status code 404. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the details of the snoozed or dismissed rule; for example, the duration, name, and GUID associated with - * the rule. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public SuppressionContractInner create(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract) { @@ -374,19 +320,7 @@ private Mono deleteAsync(String resourceUri, String recommendationId, Stri return deleteWithResponseAsync(resourceUri, recommendationId, name).flatMap(ignored -> Mono.empty()); } - /** - * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a - * recommendation is referred to as a suppression. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param recommendationId The recommendation ID. - * @param name The name of the suppression. - * @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}. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteWithResponse(String resourceUri, String recommendationId, String name, Context context) { @@ -394,17 +328,7 @@ public Response deleteWithResponse(String resourceUri, String recommendati name, context); } - /** - * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a - * recommendation is referred to as a suppression. - * - * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. - * @param recommendationId The recommendation ID. - * @param name The name of the suppression. - * @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. - */ + @Override @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String resourceUri, String recommendationId, String name) { deleteWithResponse(resourceUri, recommendationId, name, Context.NONE); @@ -479,11 +403,7 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listSinglePage(Integer top, String skipToken) { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), - this.client.getApiVersion(), this.client.getSubscriptionId(), top, skipToken, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listSinglePage(top, skipToken, Context.NONE); } /** @@ -507,33 +427,15 @@ private PagedResponse listSinglePage(Integer top, Stri res.getValue().nextLink(), null); } - /** - * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of - * a recommendation is referred to as a suppression. - * - * @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 SuppressionContract list operation as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { final Integer top = null; final String skipToken = null; - return new PagedIterable<>(() -> listSinglePage(top, skipToken), nextLink -> listNextSinglePage(nextLink)); + return list(top, skipToken, Context.NONE); } - /** - * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of - * a recommendation is referred to as a suppression. - * - * @param top The number of suppressions per page if a paged version of this API is being used. - * @param skipToken The page-continuation token to use with a paged version of this API. - * @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 SuppressionContract list operation as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Integer top, String skipToken, Context context) { return new PagedIterable<>(() -> listSinglePage(top, skipToken, context), @@ -570,11 +472,7 @@ private Mono> listNextSinglePageAsync(St */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listNextSinglePage(nextLink, Context.NONE); } /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsImpl.java index 7f0836c82c635..65805fe3703ea 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/SuppressionsImpl.java @@ -50,7 +50,7 @@ public Response deleteWithResponse(String resourceUri, String recommendati } public void delete(String resourceUri, String recommendationId, String name) { - this.serviceClient().delete(resourceUri, recommendationId, name); + this.deleteWithResponse(resourceUri, recommendationId, name, Context.NONE); } public PagedIterable list() { @@ -64,102 +64,36 @@ public PagedIterable list(Integer top, String skipToken, Co } public SuppressionContract getById(String id) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String recommendationId = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "recommendationId"); - if (recommendationId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'recommendations'.", id))); - } - String name = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "name"); - if (name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'suppressions'.", id))); - } - return this.getWithResponse(resourceUri, recommendationId, name, Context.NONE).getValue(); + return this.getByIdWithResponse(id, Context.NONE).getValue(); } public Response getByIdWithResponse(String id, Context context) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + String resourceUri = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String recommendationId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "resourceUri", "resourceUri", LOGGER); + String recommendationId = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "recommendationId"); - if (recommendationId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'recommendations'.", id))); - } - String name = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "name"); - if (name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'suppressions'.", id))); - } + "recommendationId", "recommendations", LOGGER); + String name = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", "name", + "suppressions", LOGGER); return this.getWithResponse(resourceUri, recommendationId, name, context); } public void deleteById(String id) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String recommendationId = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "recommendationId"); - if (recommendationId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'recommendations'.", id))); - } - String name = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "name"); - if (name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'suppressions'.", id))); - } - this.deleteWithResponse(resourceUri, recommendationId, name, Context.NONE); + this.deleteByIdWithResponse(id, Context.NONE); } public Response deleteByIdWithResponse(String id, Context context) { - String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + String resourceUri = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "resourceUri"); - if (resourceUri == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); - } - String recommendationId = ResourceManagerUtils.getValueFromIdByParameterName(id, + "resourceUri", "resourceUri", LOGGER); + String recommendationId = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "recommendationId"); - if (recommendationId == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'recommendations'.", id))); - } - String name = ResourceManagerUtils.getValueFromIdByParameterName(id, - "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", - "name"); - if (name == null) { - throw LOGGER.logExceptionAsError(new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'suppressions'.", id))); - } + "recommendationId", "recommendations", LOGGER); + String name = ResourceManagerUtils.getRequiredValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", "name", + "suppressions", LOGGER); return this.deleteWithResponse(resourceUri, recommendationId, name, context); } diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsClientImpl.java index e960289168f5b..4e08ab92adb2f 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsClientImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsClientImpl.java @@ -144,11 +144,7 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listSinglePage() { - final String accept = "application/json"; - Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), - this.client.getSubscriptionId(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listSinglePage(Context.NONE); } /** @@ -173,35 +169,13 @@ private PagedResponse listSinglePage(Context context) { res.getValue().nextLink(), null); } - /** - * Get Workloads list. - * - * Get list of Workloads. - * - * @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 workloads list. - * - * Get list of Workloads as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + return list(Context.NONE); } - /** - * Get Workloads list. - * - * Get list of Workloads. - * - * @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 workloads list. - * - * Get list of Workloads as paginated response with {@link PagedIterable}. - */ + @Override @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); @@ -244,11 +218,7 @@ private Mono> listNextSinglePageAsync(String */ @ServiceMethod(returns = ReturnType.SINGLE) private PagedResponse listNextSinglePage(String nextLink) { - final String accept = "application/json"; - Response res - = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), - res.getValue().nextLink(), null); + return listNextSinglePage(nextLink, Context.NONE); } /** diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsImpl.java index 6b24b4e66420f..aeeb29287dac6 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsImpl.java +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/WorkloadsImpl.java @@ -25,8 +25,7 @@ public WorkloadsImpl(WorkloadsClient innerClient, com.azure.resourcemanager.advi } public PagedIterable list() { - PagedIterable inner = this.serviceClient().list(); - return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkloadResultImpl(inner1, this.manager())); + return this.list(Context.NONE); } public PagedIterable list(Context context) {