diff --git a/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md b/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md index 58a6e143c4c7..df2afc54e4e7 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md +++ b/sdk/advisor/azure-resourcemanager-advisor/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.4 (Unreleased) +## 1.0.0-beta.1 (2024-11-12) + +- 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-2023-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/advisor/azure-resourcemanager-advisor/README.md b/sdk/advisor/azure-resourcemanager-advisor/README.md index 201907ee05a8..ff22cb6b616d 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. Package tag package-2023-01. 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 @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-advisor - 1.0.0-beta.3 + 1.0.0-beta.4 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/advisor/azure-resourcemanager-advisor/SAMPLE.md b/sdk/advisor/azure-resourcemanager-advisor/SAMPLE.md index 8b22552dc033..6b51b321025b 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/SAMPLE.md +++ b/sdk/advisor/azure-resourcemanager-advisor/SAMPLE.md @@ -1,6 +1,11 @@ # Code snippets and samples +## AdvisorScores + +- [Get](#advisorscores_get) +- [List](#advisorscores_list) + ## Configurations - [CreateInResourceGroup](#configurations_createinresourcegroup) @@ -24,12 +29,60 @@ - [GetGenerateStatus](#recommendations_getgeneratestatus) - [List](#recommendations_list) +## ResourceProvider + +- [Predict](#resourceprovider_predict) + ## Suppressions - [Create](#suppressions_create) - [Delete](#suppressions_delete) - [Get](#suppressions_get) - [List](#suppressions_list) +### AdvisorScores_Get + +```java +/** + * Samples for AdvisorScores Get. + */ +public final class AdvisorScoresGetSamples { + /* + * x-ms-original-file: + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/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: + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ListAdvisorScore.json + */ + /** + * Sample code: ListAdvisorScore. + * + * @param manager Entry point to AdvisorManager. + */ + public static void listAdvisorScore(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.advisorScores().listWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + ### Configurations_CreateInResourceGroup ```java @@ -38,6 +91,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; /** @@ -46,7 +100,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 + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/CreateConfiguration.json */ /** * Sample code: PutConfigurations. @@ -59,6 +113,7 @@ 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") @@ -81,6 +136,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; /** @@ -89,7 +145,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 + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/CreateConfiguration.json */ /** * Sample code: PutConfigurations. @@ -100,6 +156,7 @@ 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") @@ -122,7 +179,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 + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ListConfigurations.json */ /** * Sample code: GetConfigurations. @@ -144,7 +201,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 + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ListConfigurations.json */ /** * Sample code: GetConfigurations. @@ -166,14 +223,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 + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/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,7 +244,7 @@ public final class OperationsListSamples { */ public final class RecommendationMetadataGetSamples { /* - * x-ms-original-file: specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ + * x-ms-original-file: specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ * GetRecommendationMetadataEntity.json */ /** @@ -210,7 +267,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. + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ListRecommendationMetadata. * json */ /** @@ -233,7 +290,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 + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/GenerateRecommendations.json */ /** * Sample code: GenerateRecommendations. @@ -255,7 +312,7 @@ 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 + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/GetRecommendationDetail.json */ /** * Sample code: GetRecommendationDetail. @@ -279,7 +336,7 @@ import java.util.UUID; public final class RecommendationsGetGenerateStatusSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/EmptyResponse.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/EmptyResponse.json */ /** * Sample code: GetGenerateStatus. @@ -288,7 +345,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"), + .getGenerateStatusWithResponse(UUID.fromString("123e4567-e89b-12d3-a456-426614174000"), com.azure.core.util.Context.NONE); } } @@ -303,7 +360,7 @@ public final class RecommendationsGetGenerateStatusSamples { public final class RecommendationsListSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListRecommendations.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ListRecommendations.json */ /** * Sample code: ListRecommendations. @@ -316,6 +373,40 @@ public final class RecommendationsListSamples { } ``` +### ResourceProvider_Predict + +```java +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.advisor.models.PredictionRequest; +import com.azure.resourcemanager.advisor.models.PredictionType; +import java.io.IOException; + +/** + * Samples for ResourceProvider Predict. + */ +public final class ResourceProviderPredictSamples { + /* + * x-ms-original-file: + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/Predict.json + */ + /** + * Sample code: Predict. + * + * @param manager Entry point to AdvisorManager. + */ + public static void predict(com.azure.resourcemanager.advisor.AdvisorManager manager) throws IOException { + manager.resourceProviders() + .predictWithResponse(new PredictionRequest().withPredictionType(PredictionType.PREDICTIVE_RIGHTSIZING) + .withExtendedProperties(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"type\":\"iaas\",\"deploymentType\":\"Linux_IaaS_Software_Store\",\"numberOfInstances\":10,\"region\":\"CentralUS\",\"sku\":\"Standard_Dv4\"}", + Object.class, SerializerEncoding.JSON)), + com.azure.core.util.Context.NONE); + } +} +``` + ### Suppressions_Create ```java @@ -325,7 +416,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 + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/CreateSuppression.json */ /** * Sample code: CreateSuppression. @@ -351,7 +442,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 + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/DeleteSuppression.json */ /** * Sample code: DeleteSuppression. @@ -375,7 +466,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 + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/GetSuppressionDetail.json */ /** * Sample code: GetSuppressionDetail. @@ -398,7 +489,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 + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ListSuppressions.json */ /** * Sample code: ListSuppressions. diff --git a/sdk/advisor/azure-resourcemanager-advisor/pom.xml b/sdk/advisor/azure-resourcemanager-advisor/pom.xml index f8aaf1f3510b..615faa83e980 100644 --- a/sdk/advisor/azure-resourcemanager-advisor/pom.xml +++ b/sdk/advisor/azure-resourcemanager-advisor/pom.xml @@ -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. Package tag package-2023-01. https://github.com/Azure/azure-sdk-for-java @@ -46,6 +46,7 @@ 0 0 true + false 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 b39ddb6657ac..0a2a6bd391fd 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 @@ -25,15 +25,19 @@ 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.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.ResourceProvidersImpl; import com.azure.resourcemanager.advisor.implementation.SuppressionsImpl; +import com.azure.resourcemanager.advisor.models.AdvisorScores; 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.ResourceProviders; import com.azure.resourcemanager.advisor.models.Suppressions; import java.time.Duration; import java.time.temporal.ChronoUnit; @@ -57,6 +61,10 @@ public final class AdvisorManager { private Suppressions suppressions; + private ResourceProviders resourceProviders; + + private AdvisorScores advisorScores; + private final AdvisorManagementClient clientObject; private AdvisorManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -221,7 +229,7 @@ public AdvisorManager authenticate(TokenCredential credential, AzureProfile prof .append("-") .append("com.azure.resourcemanager.advisor") .append("/") - .append("1.0.0-beta.3"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -328,6 +336,30 @@ public Suppressions suppressions() { return suppressions; } + /** + * 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 AdvisorScores. + * + * @return Resource collection API of AdvisorScores. + */ + public AdvisorScores advisorScores() { + if (this.advisorScores == null) { + this.advisorScores = new AdvisorScoresImpl(clientObject.getAdvisorScores(), this); + } + return advisorScores; + } + /** * 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 4d9dd554bcfe..0afd38ac26bf 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 @@ -80,4 +80,18 @@ public interface AdvisorManagementClient { * @return the SuppressionsClient object. */ SuppressionsClient getSuppressions(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the AdvisorScoresClient object to access its operations. + * + * @return the AdvisorScoresClient object. + */ + AdvisorScoresClient getAdvisorScores(); } 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 000000000000..792a6f27854a --- /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) AutoRest 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.AdvisorScoreEntityInner; +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreResponseInner; + +/** + * An instance of this class provides access to all the operations defined in AdvisorScoresClient. + */ +public interface AdvisorScoresClient { + /** + * 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvisorScoreResponseInner list(); + + /** + * 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); +} 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 000000000000..6db2a5723817 --- /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) AutoRest 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 Parameters for predict recommendation. + * @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 Parameters for predict recommendation. + * @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/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 000000000000..bec5a787f319 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreEntityInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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.AdvisorScoreEntityProperties; +import java.io.IOException; + +/** + * The details of Advisor score for a single category. + */ +@Fluent +public final class AdvisorScoreEntityInner extends ProxyResource { + /* + * The Advisor score data. + */ + private AdvisorScoreEntityProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AdvisorScoreEntityInner class. + */ + public AdvisorScoreEntityInner() { + } + + /** + * Get the properties property: The Advisor score data. + * + * @return the properties value. + */ + public AdvisorScoreEntityProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The Advisor score data. + * + * @param properties the properties value to set. + * @return the AdvisorScoreEntityInner object itself. + */ + public AdvisorScoreEntityInner withProperties(AdvisorScoreEntityProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of 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.properties = 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/AdvisorScoreResponseInner.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreResponseInner.java new file mode 100644 index 000000000000..c00b56e2ed48 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/AdvisorScoreResponseInner.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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; +import java.util.List; + +/** + * The AdvisorScoreResponse model. + */ +@Fluent +public final class AdvisorScoreResponseInner implements JsonSerializable { + /* + * The list of operations. + */ + private List value; + + /** + * Creates an instance of AdvisorScoreResponseInner class. + */ + public AdvisorScoreResponseInner() { + } + + /** + * Get the value property: The list of operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of operations. + * + * @param value the value value to set. + * @return the AdvisorScoreResponseInner object itself. + */ + public AdvisorScoreResponseInner withValue(List value) { + this.value = value; + 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} + */ + @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 AdvisorScoreResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AdvisorScoreResponseInner 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 AdvisorScoreResponseInner. + */ + public static AdvisorScoreResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AdvisorScoreResponseInner deserializedAdvisorScoreResponseInner = new AdvisorScoreResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AdvisorScoreEntityInner.fromJson(reader1)); + deserializedAdvisorScoreResponseInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedAdvisorScoreResponseInner; + }); + } +} 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 5103b2f50be4..981d910fbbaf 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 @@ -6,11 +6,13 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; import com.azure.json.JsonReader; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import com.azure.resourcemanager.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. * @@ -200,6 +241,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 2879133c05f3..7212275dfb5e 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 @@ -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 writer.writeJson(element)); return jsonWriter.writeEndObject(); } @@ -146,6 +176,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/PredictionRequestProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionRequestProperties.java new file mode 100644 index 000000000000..d156f7613798 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionRequestProperties.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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 com.azure.resourcemanager.advisor.models.PredictionType; +import java.io.IOException; + +/** + * Properties given for the predictor. + */ +@Fluent +public final class PredictionRequestProperties implements JsonSerializable { + /* + * Type of the prediction. + */ + private PredictionType predictionType; + + /* + * Extended properties are arguments specific for each prediction type. + */ + private Object 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 Object 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(Object extendedProperties) { + this.extendedProperties = extendedProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("predictionType", + this.predictionType == null ? null : this.predictionType.toString()); + jsonWriter.writeUntypedField("extendedProperties", this.extendedProperties); + 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.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 000000000000..011479258f4e --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseInner.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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 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. + */ +@Fluent +public final class PredictionResponseInner implements JsonSerializable { + /* + * The properties of the prediction. + */ + private PredictionResponseProperties innerProperties; + + /** + * Creates an instance of PredictionResponseInner class. + */ + public 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 Object extendedProperties() { + return this.innerProperties() == null ? null : this.innerProperties().extendedProperties(); + } + + /** + * Set the extendedProperties property: Extended properties. + * + * @param extendedProperties the extendedProperties value to set. + * @return the PredictionResponseInner object itself. + */ + public PredictionResponseInner withExtendedProperties(Object extendedProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new PredictionResponseProperties(); + } + this.innerProperties().withExtendedProperties(extendedProperties); + return this; + } + + /** + * 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 PredictionResponseInner object itself. + */ + public PredictionResponseInner withPredictionType(PredictionType predictionType) { + if (this.innerProperties() == null) { + this.innerProperties = new PredictionResponseProperties(); + } + this.innerProperties().withPredictionType(predictionType); + return this; + } + + /** + * Get the category property: The category of the recommendation. + * + * @return the category value. + */ + public Category category() { + return this.innerProperties() == null ? null : this.innerProperties().category(); + } + + /** + * Set the category property: The category of the recommendation. + * + * @param category the category value to set. + * @return the PredictionResponseInner object itself. + */ + public PredictionResponseInner withCategory(Category category) { + if (this.innerProperties() == null) { + this.innerProperties = new PredictionResponseProperties(); + } + this.innerProperties().withCategory(category); + return this; + } + + /** + * 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(); + } + + /** + * Set the impact property: The business impact of the recommendation. + * + * @param impact the impact value to set. + * @return the PredictionResponseInner object itself. + */ + public PredictionResponseInner withImpact(Impact impact) { + if (this.innerProperties() == null) { + this.innerProperties = new PredictionResponseProperties(); + } + this.innerProperties().withImpact(impact); + return this; + } + + /** + * 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(); + } + + /** + * Set the impactedField property: The resource type identified by Advisor. + * + * @param impactedField the impactedField value to set. + * @return the PredictionResponseInner object itself. + */ + public PredictionResponseInner withImpactedField(String impactedField) { + if (this.innerProperties() == null) { + this.innerProperties = new PredictionResponseProperties(); + } + this.innerProperties().withImpactedField(impactedField); + return this; + } + + /** + * 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(); + } + + /** + * Set the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation. + * + * @param lastUpdated the lastUpdated value to set. + * @return the PredictionResponseInner object itself. + */ + public PredictionResponseInner withLastUpdated(OffsetDateTime lastUpdated) { + if (this.innerProperties() == null) { + this.innerProperties = new PredictionResponseProperties(); + } + this.innerProperties().withLastUpdated(lastUpdated); + return this; + } + + /** + * Get the shortDescription property: A summary of the recommendation. + * + * @return the shortDescription value. + */ + public ShortDescription shortDescription() { + return this.innerProperties() == null ? null : this.innerProperties().shortDescription(); + } + + /** + * Set the shortDescription property: A summary of the recommendation. + * + * @param shortDescription the shortDescription value to set. + * @return the PredictionResponseInner object itself. + */ + public PredictionResponseInner withShortDescription(ShortDescription shortDescription) { + if (this.innerProperties() == null) { + this.innerProperties = new PredictionResponseProperties(); + } + this.innerProperties().withShortDescription(shortDescription); + 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.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 000000000000..c39043dccaa8 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/fluent/models/PredictionResponseProperties.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.advisor.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.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. + */ +@Fluent +public final class PredictionResponseProperties implements JsonSerializable { + /* + * Extended properties + */ + private Object 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. + */ + public PredictionResponseProperties() { + } + + /** + * Get the extendedProperties property: Extended properties. + * + * @return the extendedProperties value. + */ + public Object extendedProperties() { + return this.extendedProperties; + } + + /** + * Set the extendedProperties property: Extended properties. + * + * @param extendedProperties the extendedProperties value to set. + * @return the PredictionResponseProperties object itself. + */ + public PredictionResponseProperties withExtendedProperties(Object extendedProperties) { + this.extendedProperties = extendedProperties; + return this; + } + + /** + * 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 PredictionResponseProperties object itself. + */ + public PredictionResponseProperties withPredictionType(PredictionType predictionType) { + this.predictionType = predictionType; + return this; + } + + /** + * Get the category property: The category of the recommendation. + * + * @return the category value. + */ + public Category category() { + return this.category; + } + + /** + * Set the category property: The category of the recommendation. + * + * @param category the category value to set. + * @return the PredictionResponseProperties object itself. + */ + public PredictionResponseProperties withCategory(Category category) { + this.category = category; + return this; + } + + /** + * Get the impact property: The business impact of the recommendation. + * + * @return the impact value. + */ + 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 PredictionResponseProperties object itself. + */ + public PredictionResponseProperties withImpact(Impact impact) { + this.impact = impact; + return this; + } + + /** + * Get the impactedField property: The resource type identified by Advisor. + * + * @return the impactedField value. + */ + public String impactedField() { + return this.impactedField; + } + + /** + * Set the impactedField property: The resource type identified by Advisor. + * + * @param impactedField the impactedField value to set. + * @return the PredictionResponseProperties object itself. + */ + public PredictionResponseProperties withImpactedField(String impactedField) { + this.impactedField = impactedField; + return this; + } + + /** + * 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; + } + + /** + * Set the lastUpdated property: The most recent time that Advisor checked the validity of the recommendation. + * + * @param lastUpdated the lastUpdated value to set. + * @return the PredictionResponseProperties object itself. + */ + public PredictionResponseProperties withLastUpdated(OffsetDateTime lastUpdated) { + this.lastUpdated = lastUpdated; + return this; + } + + /** + * Get the shortDescription property: A summary of the recommendation. + * + * @return the shortDescription value. + */ + public ShortDescription shortDescription() { + return this.shortDescription; + } + + /** + * Set the shortDescription property: A summary of the recommendation. + * + * @param shortDescription the shortDescription value to set. + * @return the PredictionResponseProperties object itself. + */ + public PredictionResponseProperties withShortDescription(ShortDescription shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (shortDescription() != null) { + shortDescription().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeUntypedField("extendedProperties", this.extendedProperties); + 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.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 0a497bddb049..482e0447184c 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 @@ -13,6 +13,7 @@ import com.azure.resourcemanager.advisor.models.Category; import com.azure.resourcemanager.advisor.models.Impact; import com.azure.resourcemanager.advisor.models.ResourceMetadata; +import com.azure.resourcemanager.advisor.models.Risk; import com.azure.resourcemanager.advisor.models.ShortDescription; import java.io.IOException; import java.time.OffsetDateTime; @@ -62,6 +63,11 @@ public final class RecommendationProperties implements JsonSerializable writer.writeUntyped(element)); 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))); @@ -562,6 +589,8 @@ public static RecommendationProperties fromJson(JsonReader jsonReader) throws IO 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)) { 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 2ac66aad0960..25a5a62ea284 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 @@ -6,12 +6,14 @@ 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.Category; import com.azure.resourcemanager.advisor.models.Impact; import com.azure.resourcemanager.advisor.models.ResourceMetadata; +import com.azure.resourcemanager.advisor.models.Risk; import com.azure.resourcemanager.advisor.models.ShortDescription; import java.io.IOException; import java.time.OffsetDateTime; @@ -29,6 +31,11 @@ public final class ResourceRecommendationBaseInner extends ProxyResource { */ private RecommendationProperties innerProperties; + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + /* * The type of the resource. */ @@ -59,6 +66,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. * @@ -250,6 +266,29 @@ public ResourceRecommendationBaseInner withRecommendationTypeId(String recommend return this; } + /** + * Get the risk property: The potential risk of not implementing the recommendation. + * + * @return the risk value. + */ + public Risk risk() { + return this.innerProperties() == null ? null : this.innerProperties().risk(); + } + + /** + * Set the risk property: The potential risk of not implementing the recommendation. + * + * @param risk the risk value to set. + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withRisk(Risk risk) { + if (this.innerProperties() == null) { + this.innerProperties = new RecommendationProperties(); + } + this.innerProperties().withRisk(risk); + return this; + } + /** * Get the shortDescription property: A summary of the recommendation. * @@ -553,6 +592,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 1a78e97c5a5c..c550c3baf41a 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 @@ -6,6 +6,7 @@ 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. * @@ -182,6 +197,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/implementation/AdvisorManagementClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorManagementClientImpl.java index 93357dba27d7..53be94b779c2 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 @@ -24,10 +24,12 @@ 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.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.ResourceProvidersClient; import com.azure.resourcemanager.advisor.fluent.SuppressionsClient; import java.io.IOException; import java.lang.reflect.Type; @@ -197,6 +199,34 @@ public SuppressionsClient getSuppressions() { return this.suppressions; } + /** + * The ResourceProvidersClient object to access its operations. + */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** + * 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; + } + /** * Initializes an instance of AdvisorManagementClient client. * @@ -214,12 +244,14 @@ public SuppressionsClient getSuppressions() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2020-01-01"; + this.apiVersion = "2023-01-01"; 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.resourceProviders = new ResourceProvidersClientImpl(this); + this.advisorScores = new AdvisorScoresClientImpl(this); } /** 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 000000000000..c4765d4844b1 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoreEntityImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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.AdvisorScoreEntityProperties; + +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 AdvisorScoreEntityProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + 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/AdvisorScoreResponseImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoreResponseImpl.java new file mode 100644 index 000000000000..cc2c532f2d5b --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoreResponseImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.advisor.implementation; + +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner; +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreResponseInner; +import com.azure.resourcemanager.advisor.models.AdvisorScoreEntity; +import com.azure.resourcemanager.advisor.models.AdvisorScoreResponse; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class AdvisorScoreResponseImpl implements AdvisorScoreResponse { + private AdvisorScoreResponseInner innerObject; + + private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager; + + AdvisorScoreResponseImpl(AdvisorScoreResponseInner innerObject, + com.azure.resourcemanager.advisor.AdvisorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner.stream() + .map(inner1 -> new AdvisorScoreEntityImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public AdvisorScoreResponseInner 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 000000000000..ab62c6f5cf6d --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresClientImpl.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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.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.fluent.models.AdvisorScoreResponseInner; +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("{$host}") + @ServiceInterface(name = "AdvisorManagementCli") + public interface AdvisorScoresService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/advisorScore") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/advisorScore/{name}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + } + + /** + * 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + 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(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(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(), + accept, context); + } + + /** + * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvisorScoreResponseInner list() { + return listWithResponse(Context.NONE).getValue(); + } + + /** + * 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) { + 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 (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(), this.client.getSubscriptionId(), name, + this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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} 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 (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() 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(), this.client.getSubscriptionId(), name, + this.client.getApiVersion(), 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 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) { + return getWithResponseAsync(name, context).block(); + } + + /** + * 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(); + } +} 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 000000000000..0bd90e45ae82 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/AdvisorScoresImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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.AdvisorScoresClient; +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner; +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreResponseInner; +import com.azure.resourcemanager.advisor.models.AdvisorScoreEntity; +import com.azure.resourcemanager.advisor.models.AdvisorScoreResponse; +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 listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AdvisorScoreResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AdvisorScoreResponse list() { + AdvisorScoreResponseInner inner = this.serviceClient().list(); + if (inner != null) { + return new AdvisorScoreResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + 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 AdvisorScoreEntityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AdvisorScoreEntity get(String name) { + AdvisorScoreEntityInner inner = this.serviceClient().get(name); + if (inner != null) { + return new AdvisorScoreEntityImpl(inner, this.manager()); + } else { + return null; + } + } + + 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/ConfigDataImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ConfigDataImpl.java index 2545ec4fc9ce..e96130ee34f4 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 @@ -4,12 +4,14 @@ 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/PredictionResponseImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/PredictionResponseImpl.java new file mode 100644 index 000000000000..a6d10228df95 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/PredictionResponseImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.advisor.implementation; + +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 Object 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/ResourceProvidersClientImpl.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..9c947fb615be --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.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("{$host}") + @ServiceInterface(name = "AdvisorManagementCli") + public interface ResourceProvidersService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Advisor/predict") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> predict(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PredictionRequest predictionRequest, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Predicts a recommendation. + * + * @param predictionRequest Parameters for predict recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + 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 (predictionRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter predictionRequest is required and cannot be null.")); + } else { + predictionRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.predict(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getApiVersion(), predictionRequest, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Predicts a recommendation. + * + * @param predictionRequest Parameters for predict recommendation. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> predictWithResponseAsync(PredictionRequest predictionRequest, + 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 (predictionRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter predictionRequest is required and cannot be null.")); + } else { + predictionRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.predict(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), + predictionRequest, accept, context); + } + + /** + * Predicts a recommendation. + * + * @param predictionRequest Parameters for predict recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Parameters for predict recommendation. + * @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) { + return predictWithResponseAsync(predictionRequest, context).block(); + } + + /** + * Predicts a recommendation. + * + * @param predictionRequest Parameters for predict recommendation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 000000000000..8352ed22472e --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/ResourceProvidersImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PredictionResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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 ccdc39c54e6d..60ce7da5e42d 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 @@ -4,11 +4,13 @@ package com.azure.resourcemanager.advisor.implementation; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner; import com.azure.resourcemanager.advisor.models.Category; import com.azure.resourcemanager.advisor.models.Impact; import com.azure.resourcemanager.advisor.models.ResourceMetadata; import com.azure.resourcemanager.advisor.models.ResourceRecommendationBase; +import com.azure.resourcemanager.advisor.models.Risk; import com.azure.resourcemanager.advisor.models.ShortDescription; import java.time.OffsetDateTime; import java.util.Collections; @@ -39,6 +41,10 @@ public String type() { return this.innerModel().type(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public Category category() { return this.innerModel().category(); } @@ -72,6 +78,10 @@ public String recommendationTypeId() { return this.innerModel().recommendationTypeId(); } + public Risk risk() { + return this.innerModel().risk(); + } + public ShortDescription shortDescription() { return this.innerModel().shortDescription(); } 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 ecf81cf3c9aa..ad8c1a0d62dd 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 @@ -4,6 +4,7 @@ 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(); } 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 000000000000..62a74e0fa6c3 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreEntity.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreEntityInner; + +/** + * 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 properties property: The Advisor score data. + * + * @return the properties value. + */ + AdvisorScoreEntityProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.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/AdvisorScoreEntityProperties.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreEntityProperties.java new file mode 100644 index 000000000000..ee3f57320e60 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreEntityProperties.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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; +import java.util.List; + +/** + * The Advisor score data. + */ +@Fluent +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. + */ + public AdvisorScoreEntityProperties() { + } + + /** + * Get the lastRefreshedScore property: The details of latest available score. + * + * @return the lastRefreshedScore value. + */ + public ScoreEntity lastRefreshedScore() { + return this.lastRefreshedScore; + } + + /** + * Set the lastRefreshedScore property: The details of latest available score. + * + * @param lastRefreshedScore the lastRefreshedScore value to set. + * @return the AdvisorScoreEntityProperties object itself. + */ + public AdvisorScoreEntityProperties withLastRefreshedScore(ScoreEntity lastRefreshedScore) { + this.lastRefreshedScore = lastRefreshedScore; + return this; + } + + /** + * Get the timeSeries property: The historic Advisor score data. + * + * @return the timeSeries value. + */ + public List timeSeries() { + return this.timeSeries; + } + + /** + * Set the timeSeries property: The historic Advisor score data. + * + * @param timeSeries the timeSeries value to set. + * @return the AdvisorScoreEntityProperties object itself. + */ + public AdvisorScoreEntityProperties withTimeSeries(List timeSeries) { + this.timeSeries = timeSeries; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (lastRefreshedScore() != null) { + lastRefreshedScore().validate(); + } + if (timeSeries() != null) { + timeSeries().forEach(e -> e.validate()); + } + } + + /** + * {@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 -> TimeSeriesEntityItem.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/models/AdvisorScoreResponse.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreResponse.java new file mode 100644 index 000000000000..8398e34729bd --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScoreResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.advisor.models; + +import com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of AdvisorScoreResponse. + */ +public interface AdvisorScoreResponse { + /** + * Gets the value property: The list of operations. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.advisor.fluent.models.AdvisorScoreResponseInner object. + * + * @return the inner object. + */ + AdvisorScoreResponseInner 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 000000000000..05526e75efa5 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/AdvisorScores.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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 AdvisorScores. + */ +public interface AdvisorScores { + /** + * 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 along with {@link Response}. + */ + Response listWithResponse(Context context); + + /** + * 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. + */ + AdvisorScoreResponse list(); + + /** + * 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); +} 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 000000000000..442aee2a065d --- /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) AutoRest 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/ConfigData.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ConfigData.java index a6a599714f0b..9d9ef4881dc0 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 @@ -4,6 +4,7 @@ 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/DurationModel.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/DurationModel.java new file mode 100644 index 000000000000..faad3ef4871c --- /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) AutoRest 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/PredictionRequest.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionRequest.java new file mode 100644 index 000000000000..fb397d1533a3 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionRequest.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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 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 Object 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(Object extendedProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new PredictionRequestProperties(); + } + this.innerProperties().withExtendedProperties(extendedProperties); + 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.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 000000000000..2df2aa2d42ca --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/PredictionResponse.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.advisor.models; + +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. + */ + Object 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 000000000000..f3a1edf7b76b --- /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) AutoRest 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/ResourceProviders.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ResourceProviders.java new file mode 100644 index 000000000000..fee0d452794c --- /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) AutoRest 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 Parameters for predict recommendation. + * @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 Parameters for predict recommendation. + * @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 75374f389acb..0c6e4e5040d3 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 @@ -4,6 +4,7 @@ package com.azure.resourcemanager.advisor.models; +import com.azure.core.management.SystemData; import com.azure.resourcemanager.advisor.fluent.models.ResourceRecommendationBaseInner; import java.time.OffsetDateTime; import java.util.List; @@ -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. * @@ -84,6 +92,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. * 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 000000000000..e91b7b050ded --- /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) AutoRest 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/ScoreEntity.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ScoreEntity.java new file mode 100644 index 000000000000..c92969ba88fb --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/ScoreEntity.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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 details of Advisor Score. + */ +@Fluent +public final class ScoreEntity implements JsonSerializable { + /* + * The date score was calculated. + */ + private String date; + + /* + * The percentage score. + */ + private Float score; + + /* + * The consumption units for the score. + */ + private Float consumptionUnits; + + /* + * The number of impacted resources. + */ + private Float impactedResourceCount; + + /* + * The potential percentage increase in overall score at subscription level once all recommendations in this scope + * are implemented. + */ + private Float potentialScoreIncrease; + + /* + * The count of impacted categories. + */ + private Float categoryCount; + + /** + * Creates an instance of ScoreEntity class. + */ + public ScoreEntity() { + } + + /** + * Get the date property: The date score was calculated. + * + * @return the date value. + */ + public String date() { + return this.date; + } + + /** + * Set the date property: The date score was calculated. + * + * @param date the date value to set. + * @return the ScoreEntity object itself. + */ + public ScoreEntity withDate(String date) { + this.date = date; + return this; + } + + /** + * Get the score property: The percentage score. + * + * @return the score value. + */ + public Float score() { + return this.score; + } + + /** + * Set the score property: The percentage score. + * + * @param score the score value to set. + * @return the ScoreEntity object itself. + */ + public ScoreEntity withScore(Float score) { + this.score = score; + return this; + } + + /** + * Get the consumptionUnits property: The consumption units for the score. + * + * @return the consumptionUnits value. + */ + public Float consumptionUnits() { + return this.consumptionUnits; + } + + /** + * Set the consumptionUnits property: The consumption units for the score. + * + * @param consumptionUnits the consumptionUnits value to set. + * @return the ScoreEntity object itself. + */ + public ScoreEntity withConsumptionUnits(Float consumptionUnits) { + this.consumptionUnits = consumptionUnits; + return this; + } + + /** + * Get the impactedResourceCount property: The number of impacted resources. + * + * @return the impactedResourceCount value. + */ + public Float impactedResourceCount() { + return this.impactedResourceCount; + } + + /** + * Set the impactedResourceCount property: The number of impacted resources. + * + * @param impactedResourceCount the impactedResourceCount value to set. + * @return the ScoreEntity object itself. + */ + public ScoreEntity withImpactedResourceCount(Float impactedResourceCount) { + this.impactedResourceCount = impactedResourceCount; + return this; + } + + /** + * 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 Float potentialScoreIncrease() { + return this.potentialScoreIncrease; + } + + /** + * Set the potentialScoreIncrease property: The potential percentage increase in overall score at subscription level + * once all recommendations in this scope are implemented. + * + * @param potentialScoreIncrease the potentialScoreIncrease value to set. + * @return the ScoreEntity object itself. + */ + public ScoreEntity withPotentialScoreIncrease(Float potentialScoreIncrease) { + this.potentialScoreIncrease = potentialScoreIncrease; + return this; + } + + /** + * Get the categoryCount property: The count of impacted categories. + * + * @return the categoryCount value. + */ + public Float categoryCount() { + return this.categoryCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("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::getFloat); + } else if ("consumptionUnits".equals(fieldName)) { + deserializedScoreEntity.consumptionUnits = reader.getNullable(JsonReader::getFloat); + } else if ("impactedResourceCount".equals(fieldName)) { + deserializedScoreEntity.impactedResourceCount = reader.getNullable(JsonReader::getFloat); + } else if ("potentialScoreIncrease".equals(fieldName)) { + deserializedScoreEntity.potentialScoreIncrease = reader.getNullable(JsonReader::getFloat); + } else if ("categoryCount".equals(fieldName)) { + deserializedScoreEntity.categoryCount = reader.getNullable(JsonReader::getFloat); + } else { + reader.skipChildren(); + } + } + + return deserializedScoreEntity; + }); + } +} 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 ed8668db4c7a..9ea9acff4e62 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 @@ -4,6 +4,7 @@ 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.SuppressionContractInner; import java.time.OffsetDateTime; @@ -33,6 +34,13 @@ public interface SuppressionContract { */ String type(); + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the suppressionId property: The GUID of the suppression. * diff --git a/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/TimeSeriesEntityItem.java b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/TimeSeriesEntityItem.java new file mode 100644 index 000000000000..05a0cb8f4e77 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/models/TimeSeriesEntityItem.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest 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; +import java.util.List; + +/** + * The data from different aggregation levels. + */ +@Fluent +public final class TimeSeriesEntityItem implements JsonSerializable { + /* + * The aggregation level of the score. + */ + private Aggregated aggregationLevel; + + /* + * The past score data + */ + private List scoreHistory; + + /** + * Creates an instance of TimeSeriesEntityItem class. + */ + public TimeSeriesEntityItem() { + } + + /** + * Get the aggregationLevel property: The aggregation level of the score. + * + * @return the aggregationLevel value. + */ + public Aggregated aggregationLevel() { + return this.aggregationLevel; + } + + /** + * Set the aggregationLevel property: The aggregation level of the score. + * + * @param aggregationLevel the aggregationLevel value to set. + * @return the TimeSeriesEntityItem object itself. + */ + public TimeSeriesEntityItem withAggregationLevel(Aggregated aggregationLevel) { + this.aggregationLevel = aggregationLevel; + return this; + } + + /** + * Get the scoreHistory property: The past score data. + * + * @return the scoreHistory value. + */ + public List scoreHistory() { + return this.scoreHistory; + } + + /** + * Set the scoreHistory property: The past score data. + * + * @param scoreHistory the scoreHistory value to set. + * @return the TimeSeriesEntityItem object itself. + */ + public TimeSeriesEntityItem withScoreHistory(List scoreHistory) { + this.scoreHistory = scoreHistory; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (scoreHistory() != null) { + scoreHistory().forEach(e -> e.validate()); + } + } + + /** + * {@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 TimeSeriesEntityItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TimeSeriesEntityItem 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 TimeSeriesEntityItem. + */ + public static TimeSeriesEntityItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TimeSeriesEntityItem deserializedTimeSeriesEntityItem = new TimeSeriesEntityItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("aggregationLevel".equals(fieldName)) { + deserializedTimeSeriesEntityItem.aggregationLevel = Aggregated.fromString(reader.getString()); + } else if ("scoreHistory".equals(fieldName)) { + List scoreHistory = reader.readArray(reader1 -> ScoreEntity.fromJson(reader1)); + deserializedTimeSeriesEntityItem.scoreHistory = scoreHistory; + } else { + reader.skipChildren(); + } + } + + return deserializedTimeSeriesEntityItem; + }); + } +} 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 ba5a1b9a7a3b..28007d658a8c 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.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.ResourceProvidersClientImpl$ResourceProvidersService"],["com.azure.resourcemanager.advisor.implementation.SuppressionsClientImpl$SuppressionsService"]] \ No newline at end of file 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 000000000000..60b2ee1b0d7a --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.advisor.generated; + +/** + * Samples for AdvisorScores Get. + */ +public final class AdvisorScoresGetSamples { + /* + * x-ms-original-file: + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/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 000000000000..affbd6fc2a10 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/AdvisorScoresListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.advisor.generated; + +/** + * Samples for AdvisorScores List. + */ +public final class AdvisorScoresListSamples { + /* + * x-ms-original-file: + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ListAdvisorScore.json + */ + /** + * Sample code: ListAdvisorScore. + * + * @param manager Entry point to AdvisorManager. + */ + public static void listAdvisorScore(com.azure.resourcemanager.advisor.AdvisorManager manager) { + manager.advisorScores().listWithResponse(com.azure.core.util.Context.NONE); + } +} 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 890ad87ad7e1..3af049b1621f 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 @@ -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; /** @@ -17,7 +18,7 @@ public final class ConfigurationsCreateInResourceGroupSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/CreateConfiguration.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/CreateConfiguration.json */ /** * Sample code: PutConfigurations. @@ -30,6 +31,7 @@ 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") 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 6b5f9fab2c13..4de5e66f483c 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 @@ -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; /** @@ -18,7 +19,7 @@ public final class ConfigurationsCreateInSubscriptionSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/CreateConfiguration.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/CreateConfiguration.json */ /** * Sample code: PutConfigurations. @@ -29,6 +30,7 @@ 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") 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 753bfd33e9fe..f2b8a99d9616 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 @@ -10,7 +10,7 @@ public final class ConfigurationsListByResourceGroupSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListConfigurations.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/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 b3eba2a41274..1748738294c8 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 @@ -10,7 +10,7 @@ public final class ConfigurationsListSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListConfigurations.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ListConfigurations.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 e5d0c0cc6fa6..1d613e3ea067 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 @@ -10,14 +10,14 @@ public final class OperationsListSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListOperations.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/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 0870ad8e4827..dc2018005a0f 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 @@ -9,7 +9,7 @@ */ public final class RecommendationMetadataGetSamples { /* - * x-ms-original-file: specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ + * x-ms-original-file: specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ * GetRecommendationMetadataEntity.json */ /** 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 a323f67468e3..acaa022fbd83 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 @@ -10,7 +10,7 @@ public final class RecommendationMetadataListSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListRecommendationMetadata. + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ListRecommendationMetadata. * json */ /** 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 10ff36f412d5..1b6b3e0a20f4 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 @@ -10,7 +10,7 @@ public final class RecommendationsGenerateSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GenerateRecommendations.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/GenerateRecommendations.json */ /** * Sample code: GenerateRecommendations. 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 2968c171d3cc..1fd3ed2b1daa 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 @@ -12,7 +12,7 @@ public final class RecommendationsGetGenerateStatusSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/EmptyResponse.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/EmptyResponse.json */ /** * Sample code: GetGenerateStatus. @@ -21,7 +21,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"), + .getGenerateStatusWithResponse(UUID.fromString("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 93655c79e71e..de5370340bc6 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 @@ -10,7 +10,7 @@ public final class RecommendationsGetSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetRecommendationDetail.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/GetRecommendationDetail.json */ /** * Sample code: GetRecommendationDetail. 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 6770b6e4c074..9693074e47dd 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 @@ -10,7 +10,7 @@ public final class RecommendationsListSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListRecommendations.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ListRecommendations.json */ /** * Sample code: ListRecommendations. 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 000000000000..702310612862 --- /dev/null +++ b/sdk/advisor/azure-resourcemanager-advisor/src/samples/java/com/azure/resourcemanager/advisor/generated/ResourceProviderPredictSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.advisor.generated; + +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.advisor.models.PredictionRequest; +import com.azure.resourcemanager.advisor.models.PredictionType; +import java.io.IOException; + +/** + * Samples for ResourceProvider Predict. + */ +public final class ResourceProviderPredictSamples { + /* + * x-ms-original-file: + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/Predict.json + */ + /** + * Sample code: Predict. + * + * @param manager Entry point to AdvisorManager. + */ + public static void predict(com.azure.resourcemanager.advisor.AdvisorManager manager) throws IOException { + manager.resourceProviders() + .predictWithResponse(new PredictionRequest().withPredictionType(PredictionType.PREDICTIVE_RIGHTSIZING) + .withExtendedProperties(SerializerFactory.createDefaultManagementSerializerAdapter() + .deserialize( + "{\"type\":\"iaas\",\"deploymentType\":\"Linux_IaaS_Software_Store\",\"numberOfInstances\":10,\"region\":\"CentralUS\",\"sku\":\"Standard_Dv4\"}", + Object.class, SerializerEncoding.JSON)), + 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 c056648c3b92..791522714850 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 @@ -10,7 +10,7 @@ public final class SuppressionsCreateSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/CreateSuppression.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/CreateSuppression.json */ /** * Sample code: CreateSuppression. 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 027f1949ad49..c620b84a202e 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 @@ -10,7 +10,7 @@ public final class SuppressionsDeleteSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/DeleteSuppression.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/DeleteSuppression.json */ /** * Sample code: DeleteSuppression. 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 84838a00c749..4a37fdef98c5 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 @@ -10,7 +10,7 @@ public final class SuppressionsGetSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/GetSuppressionDetail.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/GetSuppressionDetail.json */ /** * Sample code: GetSuppressionDetail. 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 3c1649440841..3f1bcc2843a6 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 @@ -10,7 +10,7 @@ public final class SuppressionsListSamples { /* * x-ms-original-file: - * specification/advisor/resource-manager/Microsoft.Advisor/stable/2020-01-01/examples/ListSuppressions.json + * specification/advisor/resource-manager/Microsoft.Advisor/stable/2023-01-01/examples/ListSuppressions.json */ /** * Sample code: ListSuppressions. 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 deleted file mode 100644 index d42475b30d68..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigDataInnerTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.models.Category; -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 org.junit.jupiter.api.Assertions; - -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\"}") - .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.assertEquals(Category.SECURITY, model.digests().get(0).categories().get(0)); - Assertions.assertEquals("dpvwryoqpsoaccta", 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))); - 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.assertEquals(Category.SECURITY, model.digests().get(0).categories().get(0)); - Assertions.assertEquals("dpvwryoqpsoaccta", 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 deleted file mode 100644 index 72e45211342e..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigDataPropertiesTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.advisor.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.fluent.models.ConfigDataProperties; -import com.azure.resourcemanager.advisor.models.Category; -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 org.junit.jupiter.api.Assertions; - -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\"}]}") - .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.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) - .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") - .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) - .withCategories( - Arrays.asList(Category.HIGH_AVAILABILITY, Category.HIGH_AVAILABILITY, Category.SECURITY)) - .withLanguage("usivye") - .withState(DigestConfigState.DISABLED))); - 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.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 deleted file mode 100644 index 0a2048e307a3..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationListResultTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.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 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\"}") - .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()); - } - - @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()); - } -} 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 deleted file mode 100644 index 8aa614682781..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInResourceGroupWithResponseMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.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.ConfigurationName; -import com.azure.resourcemanager.advisor.models.CpuThreshold; -import com.azure.resourcemanager.advisor.models.DigestConfig; -import com.azure.resourcemanager.advisor.models.DigestConfigState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -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\"}"; - - 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)); - - ConfigData response = manager.configurations() - .define(ConfigurationName.DEFAULT) - .withExistingResourceGroup("irx") - .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") - .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()); - } -} 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 deleted file mode 100644 index e1192f1573ca..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsCreateInSubscriptionWithResponseMockTests.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.test.http.MockHttpResponse; -import com.azure.resourcemanager.advisor.AdvisorManager; -import com.azure.resourcemanager.advisor.fluent.models.ConfigDataInner; -import com.azure.resourcemanager.advisor.models.Category; -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.DigestConfigState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -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\"}"; - - 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)); - - 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(); - - 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.assertEquals(Category.COST, response.digests().get(0).categories().get(0)); - Assertions.assertEquals("zyexzn", 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 deleted file mode 100644 index 10032fa2e29e..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListByResourceGroupMockTests.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.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 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 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\"}]}"; - - 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)); - - PagedIterable response - = manager.configurations().listByResourceGroup("rmfqjhhkxbpvj", 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.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()); - } -} 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 deleted file mode 100644 index e49d3db76be0..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ConfigurationsListMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.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 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 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\"}]}"; - - 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)); - - 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.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 deleted file mode 100644 index aa6d91c0d2c1..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/DigestConfigTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.advisor.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.models.Category; -import com.azure.resourcemanager.advisor.models.DigestConfig; -import com.azure.resourcemanager.advisor.models.DigestConfigState; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -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\"}") - .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()); - } - - @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); - 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()); - } -} 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 deleted file mode 100644 index 1a3c655bd376..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityInnerTests.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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\"}]}}") - .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()); - } - - @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()); - } -} 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 deleted file mode 100644 index f7d7e5e6b5eb..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityListResultTests.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.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\"}") - .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()); - } - - @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()); - } -} 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 deleted file mode 100644 index 2ad3211d7a4e..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataEntityPropertiesTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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\"}]}") - .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()); - } - - @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()); - } -} 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 deleted file mode 100644 index bff8bb660f54..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/MetadataSupportedValueDetailTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.advisor.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.models.MetadataSupportedValueDetail; -import org.junit.jupiter.api.Assertions; - -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()); - } -} 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 deleted file mode 100644 index 70d249fef21c..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationDisplayInfoTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.advisor.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.models.OperationDisplayInfo; -import org.junit.jupiter.api.Assertions; - -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\"}") - .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()); - } -} 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 deleted file mode 100644 index 454733e26df3..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationEntityInnerTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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\"}}") - .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()); - } -} 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 deleted file mode 100644 index 6310da56a44d..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationEntityListResultTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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 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\"}}]}") - .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()); - } -} 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 deleted file mode 100644 index c23e100b8ed4..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/OperationsListMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.test.http.MockHttpResponse; -import com.azure.resourcemanager.advisor.AdvisorManager; -import com.azure.resourcemanager.advisor.models.OperationEntity; -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 OperationsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"name\":\"imjwosyt\",\"display\":{\"description\":\"cskfcktqumiekk\",\"operation\":\"zikhl\",\"provider\":\"jhdgqggebdunyga\",\"resource\":\"idb\"}}]}"; - - 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)); - - 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()); - } -} 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 deleted file mode 100644 index 1ddaa3f2c06a..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadatasGetWithResponseMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.test.http.MockHttpResponse; -import com.azure.resourcemanager.advisor.AdvisorManager; -import com.azure.resourcemanager.advisor.models.MetadataEntity; -import com.azure.resourcemanager.advisor.models.Scenario; -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 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\"}]}}"; - - 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)); - - MetadataEntity response = manager.recommendationMetadatas() - .getWithResponse("kqujidsuyono", 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(Scenario.ALERTS, response.applicableScenarios().get(0)); - Assertions.assertEquals("ehhseyvjusrts", response.supportedValues().get(0).id()); - Assertions.assertEquals("spkdee", 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 deleted file mode 100644 index 4e5afe1a8262..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationMetadatasListMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.test.http.MockHttpResponse; -import com.azure.resourcemanager.advisor.AdvisorManager; -import com.azure.resourcemanager.advisor.models.MetadataEntity; -import com.azure.resourcemanager.advisor.models.Scenario; -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 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\"}]}}]}"; - - 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)); - - PagedIterable response - = manager.recommendationMetadatas().list(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(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()); - } -} 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 deleted file mode 100644 index a3829654e27e..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationPropertiesTests.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.Impact; -import com.azure.resourcemanager.advisor.models.ResourceMetadata; -import com.azure.resourcemanager.advisor.models.ShortDescription; -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\":[\"714dacd0-9228-4963-ae4d-e6ffc0c99a6b\"],\"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\"}}") - .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("714dacd0-9228-4963-ae4d-e6ffc0c99a6b"), 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("714dacd0-9228-4963-ae4d-e6ffc0c99a6b"))) - .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("714dacd0-9228-4963-ae4d-e6ffc0c99a6b"), 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; - } -} 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 deleted file mode 100644 index 09ebd14fccec..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGenerateWithResponseMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.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 RecommendationsGenerateWithResponseMockTests { - @Test - public void testGenerateWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 202, 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)); - - 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/RecommendationsGetGenerateStatusWithResponseMockTests.java b/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetGenerateStatusWithResponseMockTests.java deleted file mode 100644 index e9fe9d101827..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetGenerateStatusWithResponseMockTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.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; - -public final class RecommendationsGetGenerateStatusWithResponseMockTests { - @Test - public void testGetGenerateStatusWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 202, 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)); - - manager.recommendations() - .getGenerateStatusWithResponse(UUID.fromString("705685dd-83ee-4dc2-b787-d7e07bbc4015"), - 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 deleted file mode 100644 index 8bdcfb7f40d8..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsGetWithResponseMockTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.test.http.MockHttpResponse; -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.ResourceRecommendationBase; -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; - -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\":[\"f1a42f8d-1b83-49bc-a8c2-1e8a90fc1316\",\"9f255689-d5b1-4bcd-b67b-985b47dea14c\",\"2c2196ba-31ea-480c-9abc-f004c6d96853\"],\"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\"}"; - - 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)); - - ResourceRecommendationBase response = manager.recommendations() - .getWithResponse("obyu", "erpqlpqwcciuqg", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals(Category.HIGH_AVAILABILITY, response.category()); - 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("f1a42f8d-1b83-49bc-a8c2-1e8a90fc1316"), - 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()); - } -} 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 deleted file mode 100644 index e6fe7df8f0e8..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/RecommendationsListMockTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.test.http.MockHttpResponse; -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.ResourceRecommendationBase; -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; - -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\":[\"8a4432a2-3b19-409f-b383-7d1bdd4d7ba2\",\"1cecd4e7-eb54-4f9b-8761-32ac7c3dfe2a\",\"398819e6-d82f-42db-ae6b-793d00ab60ef\",\"32b8ef21-341e-4099-a263-ec8c50cf166b\"],\"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\"}]}"; - - 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)); - - PagedIterable response - = manager.recommendations().list("ssl", 1696619816, "fmmdnbbg", com.azure.core.util.Context.NONE); - - Assertions.assertEquals(Category.PERFORMANCE, response.iterator().next().category()); - 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("8a4432a2-3b19-409f-b383-7d1bdd4d7ba2"), - 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()); - } -} 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 deleted file mode 100644 index 943d3a92edc8..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceMetadataTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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\"}") - .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; - } -} 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 deleted file mode 100644 index 39596a6718a2..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationBaseInnerTests.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.Impact; -import com.azure.resourcemanager.advisor.models.ResourceMetadata; -import com.azure.resourcemanager.advisor.models.ShortDescription; -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\":[\"37839f42-46dc-43e1-9db9-ca4fa26ae387\",\"3a7ecc4d-1550-44cd-80f0-5d2e3013b46e\",\"ca1cfab0-831f-429b-bc10-f401505cd32e\"],\"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\"}") - .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("37839f42-46dc-43e1-9db9-ca4fa26ae387"), 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("37839f42-46dc-43e1-9db9-ca4fa26ae387"), - UUID.fromString("3a7ecc4d-1550-44cd-80f0-5d2e3013b46e"), - UUID.fromString("ca1cfab0-831f-429b-bc10-f401505cd32e"))) - .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("37839f42-46dc-43e1-9db9-ca4fa26ae387"), 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; - } -} 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 deleted file mode 100644 index 34cdca1521f7..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ResourceRecommendationBaseListResultTests.java +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.Impact; -import com.azure.resourcemanager.advisor.models.ResourceMetadata; -import com.azure.resourcemanager.advisor.models.ResourceRecommendationBaseListResult; -import com.azure.resourcemanager.advisor.models.ShortDescription; -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\":[\"c13f32b8-d2fa-4d70-b469-81e0a577ef1b\",\"45ca269b-31e1-452b-a64f-6b74ab382928\",\"e7cd66a3-dda5-4300-83f8-938004538dea\",\"7255a6c2-82a4-4596-ac17-2c8377670933\"],\"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\":[\"9c1e3d24-cfef-42cd-b289-38d9dc535e42\"],\"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\"}]}") - .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("c13f32b8-d2fa-4d70-b469-81e0a577ef1b"), - 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("c13f32b8-d2fa-4d70-b469-81e0a577ef1b"), - UUID.fromString("45ca269b-31e1-452b-a64f-6b74ab382928"), - UUID.fromString("e7cd66a3-dda5-4300-83f8-938004538dea"), - UUID.fromString("7255a6c2-82a4-4596-ac17-2c8377670933"))) - .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("9c1e3d24-cfef-42cd-b289-38d9dc535e42"))) - .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("c13f32b8-d2fa-4d70-b469-81e0a577ef1b"), - 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; - } -} 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 deleted file mode 100644 index 9a5716f92767..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/ShortDescriptionTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.advisor.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.models.ShortDescription; -import org.junit.jupiter.api.Assertions; - -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()); - } -} 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 deleted file mode 100644 index 5238bdc8b670..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionContractInnerTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.advisor.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.fluent.models.SuppressionContractInner; -import org.junit.jupiter.api.Assertions; - -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\"}") - .toObject(SuppressionContractInner.class); - Assertions.assertEquals("mkfssxqukkfplgm", model.suppressionId()); - Assertions.assertEquals("xnkjzkdesl", model.ttl()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SuppressionContractInner model - = new SuppressionContractInner().withSuppressionId("mkfssxqukkfplgm").withTtl("xnkjzkdesl"); - model = BinaryData.fromObject(model).toObject(SuppressionContractInner.class); - Assertions.assertEquals("mkfssxqukkfplgm", model.suppressionId()); - Assertions.assertEquals("xnkjzkdesl", 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 deleted file mode 100644 index 4f816aefa4a0..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionContractListResultTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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 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\"}]}") - .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()); - } -} 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 deleted file mode 100644 index 133bc8dd9429..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionPropertiesTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.advisor.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.advisor.fluent.models.SuppressionProperties; -import org.junit.jupiter.api.Assertions; - -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\"}") - .toObject(SuppressionProperties.class); - Assertions.assertEquals("a", model.suppressionId()); - Assertions.assertEquals("nyqupedeojnabck", model.ttl()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SuppressionProperties model = new SuppressionProperties().withSuppressionId("a").withTtl("nyqupedeojnabck"); - model = BinaryData.fromObject(model).toObject(SuppressionProperties.class); - Assertions.assertEquals("a", model.suppressionId()); - Assertions.assertEquals("nyqupedeojnabck", 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 deleted file mode 100644 index 27d47be61e96..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsCreateWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.test.http.MockHttpResponse; -import com.azure.resourcemanager.advisor.AdvisorManager; -import com.azure.resourcemanager.advisor.models.SuppressionContract; -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 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\"}"; - - 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)); - - SuppressionContract response = manager.suppressions() - .define("r") - .withExistingRecommendation("brqubp", "xhexiilivpdti") - .withSuppressionId("qoaxoruzfgs") - .withTtl("yfxrx") - .create(); - - Assertions.assertEquals("ooaojkniodkooebw", response.suppressionId()); - Assertions.assertEquals("jhemms", 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 deleted file mode 100644 index 12d05a20e8c9..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsDeleteWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.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 SuppressionsDeleteWithResponseMockTests { - @Test - public void testDeleteWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 204, 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)); - - manager.suppressions() - .deleteWithResponse("sofwqmzqalkrmnji", "pxacqqudfn", "yxbaaabjyvayf", 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 deleted file mode 100644 index 39726da509e2..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsGetWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.test.http.MockHttpResponse; -import com.azure.resourcemanager.advisor.AdvisorManager; -import com.azure.resourcemanager.advisor.models.SuppressionContract; -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 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\"}"; - - 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)); - - SuppressionContract response = manager.suppressions() - .getWithResponse("fatpxllrxcyjmoa", "su", "arm", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("mjsjqb", response.suppressionId()); - Assertions.assertEquals("hyxxrwlycoduhpk", 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 deleted file mode 100644 index 8bc477a361f4..000000000000 --- a/sdk/advisor/azure-resourcemanager-advisor/src/test/java/com/azure/resourcemanager/advisor/generated/SuppressionsListMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest 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.test.http.MockHttpResponse; -import com.azure.resourcemanager.advisor.AdvisorManager; -import com.azure.resourcemanager.advisor.models.SuppressionContract; -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 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\"}]}"; - - 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)); - - PagedIterable response - = manager.suppressions().list(662894219, "m", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("tuzqogsexne", response.iterator().next().suppressionId()); - Assertions.assertEquals("dnw", response.iterator().next().ttl()); - } -}