From f4a0ba883cfeed78f94e68ceb413cb8835d118f3 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 6 Aug 2018 10:21:35 -0700 Subject: [PATCH] Generated from 2be7ef7e6f683c16e394595b2570e3e9d131e676 (#2274) Add extended properties to recommendation model --- .../v2016_07_12_preview/pom.xml | 133 ++++ .../advisor/v2016_07_12_preview/Category.java | 47 ++ .../advisor/v2016_07_12_preview/Impact.java | 44 ++ .../OperationDisplayInfo.java | 121 +++ .../v2016_07_12_preview/OperationEntity.java | 30 + .../v2016_07_12_preview/Operations.java | 27 + .../v2016_07_12_preview/Recommendations.java | 49 ++ .../RecommendationsGenerateHeaders.java | 70 ++ .../ResourceRecommendationBase.java | 91 +++ .../advisor/v2016_07_12_preview/Risk.java | 44 ++ .../v2016_07_12_preview/ShortDescription.java | 69 ++ .../SuppressionContract.java | 196 +++++ .../v2016_07_12_preview/Suppressions.java | 51 ++ .../AdvisorManagementClientImpl.java | 224 ++++++ .../implementation/AdvisorManager.java | 123 ++++ .../implementation/IdParsingUtils.java | 57 ++ .../implementation/OperationEntityImpl.java | 37 + .../implementation/OperationEntityInner.java | 70 ++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 +++++++ .../implementation/PageImpl.java | 75 ++ .../implementation/PageImpl1.java | 75 ++ .../implementation/RecommendationsImpl.java | 94 +++ .../implementation/RecommendationsInner.java | 655 +++++++++++++++++ .../ResourceRecommendationBaseImpl.java | 114 +++ .../ResourceRecommendationBaseInner.java | 370 ++++++++++ .../SuppressionContractImpl.java | 144 ++++ .../SuppressionContractInner.java | 73 ++ .../implementation/SuppressionsImpl.java | 81 ++ .../implementation/SuppressionsInner.java | 437 +++++++++++ .../implementation/package-info.java | 11 + .../v2016_07_12_preview/package-info.java | 11 + advisor/resource-manager/v2017_03_31/pom.xml | 133 ++++ .../advisor/v2017_03_31/Category.java | 47 ++ .../advisor/v2017_03_31/Impact.java | 44 ++ .../v2017_03_31/OperationDisplayInfo.java | 121 +++ .../advisor/v2017_03_31/OperationEntity.java | 30 + .../advisor/v2017_03_31/Operations.java | 27 + .../advisor/v2017_03_31/Recommendations.java | 49 ++ .../RecommendationsGenerateHeaders.java | 70 ++ .../ResourceRecommendationBase.java | 91 +++ .../management/advisor/v2017_03_31/Risk.java | 44 ++ .../advisor/v2017_03_31/ShortDescription.java | 69 ++ .../v2017_03_31/SuppressionContract.java | 145 ++++ .../advisor/v2017_03_31/Suppressions.java | 51 ++ .../AdvisorManagementClientImpl.java | 224 ++++++ .../implementation/AdvisorManager.java | 123 ++++ .../implementation/IdParsingUtils.java | 57 ++ .../implementation/OperationEntityImpl.java | 37 + .../implementation/OperationEntityInner.java | 70 ++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 +++++++ .../v2017_03_31/implementation/PageImpl.java | 75 ++ .../v2017_03_31/implementation/PageImpl1.java | 75 ++ .../implementation/RecommendationsImpl.java | 94 +++ .../implementation/RecommendationsInner.java | 655 +++++++++++++++++ .../ResourceRecommendationBaseImpl.java | 114 +++ .../ResourceRecommendationBaseInner.java | 292 ++++++++ .../SuppressionContractImpl.java | 121 +++ .../SuppressionContractInner.java | 73 ++ .../implementation/SuppressionsImpl.java | 81 ++ .../implementation/SuppressionsInner.java | 437 +++++++++++ .../implementation/package-info.java | 11 + .../advisor/v2017_03_31/package-info.java | 11 + advisor/resource-manager/v2017_04_19/pom.xml | 133 ++++ .../v2017_04_19/ARMErrorResponseBody.java | 30 + .../advisor/v2017_04_19/Category.java | 47 ++ .../advisor/v2017_04_19/ConfigData.java | 40 + .../v2017_04_19/ConfigDataProperties.java | 98 +++ .../advisor/v2017_04_19/Configurations.java | 42 ++ .../advisor/v2017_04_19/Impact.java | 44 ++ .../v2017_04_19/OperationDisplayInfo.java | 121 +++ .../advisor/v2017_04_19/OperationEntity.java | 30 + .../advisor/v2017_04_19/Operations.java | 27 + .../advisor/v2017_04_19/Recommendations.java | 49 ++ .../RecommendationsGenerateHeaders.java | 70 ++ .../ResourceRecommendationBase.java | 96 +++ .../management/advisor/v2017_04_19/Risk.java | 44 ++ .../advisor/v2017_04_19/ShortDescription.java | 69 ++ .../v2017_04_19/SuppressionContract.java | 145 ++++ .../advisor/v2017_04_19/Suppressions.java | 51 ++ .../ARMErrorResponseBodyImpl.java | 36 + .../ARMErrorResponseBodyInner.java | 71 ++ .../AdvisorManagementClientImpl.java | 238 ++++++ .../implementation/AdvisorManager.java | 135 ++++ .../implementation/ConfigDataImpl.java | 52 ++ .../implementation/ConfigDataInner.java | 122 +++ .../implementation/ConfigurationsImpl.java | 117 +++ .../implementation/ConfigurationsInner.java | 575 +++++++++++++++ .../implementation/IdParsingUtils.java | 57 ++ .../implementation/OperationEntityImpl.java | 37 + .../implementation/OperationEntityInner.java | 70 ++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 +++++++ .../v2017_04_19/implementation/PageImpl.java | 75 ++ .../v2017_04_19/implementation/PageImpl1.java | 75 ++ .../implementation/RecommendationsImpl.java | 94 +++ .../implementation/RecommendationsInner.java | 655 +++++++++++++++++ .../ResourceRecommendationBaseImpl.java | 119 +++ .../ResourceRecommendationBaseInner.java | 318 ++++++++ .../SuppressionContractImpl.java | 121 +++ .../SuppressionContractInner.java | 73 ++ .../implementation/SuppressionsImpl.java | 81 ++ .../implementation/SuppressionsInner.java | 693 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../advisor/v2017_04_19/package-info.java | 11 + 106 files changed, 13062 insertions(+) create mode 100644 advisor/resource-manager/v2016_07_12_preview/pom.xml create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Category.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Impact.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/OperationDisplayInfo.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/OperationEntity.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Operations.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Recommendations.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/RecommendationsGenerateHeaders.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/ResourceRecommendationBase.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Risk.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/ShortDescription.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/SuppressionContract.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Suppressions.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/AdvisorManagementClientImpl.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/AdvisorManager.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/IdParsingUtils.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationEntityImpl.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationEntityInner.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationsImpl.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationsInner.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/PageImpl.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/PageImpl1.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/RecommendationsImpl.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/RecommendationsInner.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/ResourceRecommendationBaseImpl.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/ResourceRecommendationBaseInner.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionContractImpl.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionContractInner.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionsImpl.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionsInner.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/package-info.java create mode 100644 advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/package-info.java create mode 100644 advisor/resource-manager/v2017_03_31/pom.xml create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Category.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Impact.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/OperationDisplayInfo.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/OperationEntity.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Operations.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Recommendations.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/RecommendationsGenerateHeaders.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/ResourceRecommendationBase.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Risk.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/ShortDescription.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/SuppressionContract.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Suppressions.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/AdvisorManagementClientImpl.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/AdvisorManager.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/IdParsingUtils.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationEntityImpl.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationEntityInner.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationsImpl.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationsInner.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/PageImpl.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/PageImpl1.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/RecommendationsImpl.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/RecommendationsInner.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/ResourceRecommendationBaseImpl.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/ResourceRecommendationBaseInner.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionContractImpl.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionContractInner.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionsImpl.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionsInner.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/package-info.java create mode 100644 advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/package-info.java create mode 100644 advisor/resource-manager/v2017_04_19/pom.xml create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ARMErrorResponseBody.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Category.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ConfigData.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ConfigDataProperties.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Configurations.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Impact.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/OperationDisplayInfo.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/OperationEntity.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Operations.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Recommendations.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/RecommendationsGenerateHeaders.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ResourceRecommendationBase.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Risk.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ShortDescription.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/SuppressionContract.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Suppressions.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ARMErrorResponseBodyImpl.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ARMErrorResponseBodyInner.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/AdvisorManagementClientImpl.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/AdvisorManager.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigDataImpl.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigDataInner.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigurationsImpl.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigurationsInner.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/IdParsingUtils.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationEntityImpl.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationEntityInner.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationsImpl.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationsInner.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/PageImpl.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/PageImpl1.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/RecommendationsImpl.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/RecommendationsInner.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ResourceRecommendationBaseImpl.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ResourceRecommendationBaseInner.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionContractImpl.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionContractInner.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionsImpl.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionsInner.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/package-info.java create mode 100644 advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/package-info.java diff --git a/advisor/resource-manager/v2016_07_12_preview/pom.xml b/advisor/resource-manager/v2016_07_12_preview/pom.xml new file mode 100644 index 0000000000000..4bb8c1fd018cf --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.advisor.v2016_07_12_preview + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-advisor + 1.0.0-beta + jar + Microsoft Azure SDK for Advisor Management + This package contains Microsoft Advisor Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Category.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Category.java new file mode 100644 index 0000000000000..d466004085cd6 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Category.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Category. + */ +public final class Category extends ExpandableStringEnum { + /** Static value HighAvailability for Category. */ + public static final Category HIGH_AVAILABILITY = fromString("HighAvailability"); + + /** Static value Security for Category. */ + public static final Category SECURITY = fromString("Security"); + + /** Static value Performance for Category. */ + public static final Category PERFORMANCE = fromString("Performance"); + + /** Static value Cost for Category. */ + public static final Category COST = fromString("Cost"); + + /** + * Creates or finds a Category from its string representation. + * @param name a name to look for + * @return the corresponding Category + */ + @JsonCreator + public static Category fromString(String name) { + return fromString(name, Category.class); + } + + /** + * @return known Category values + */ + public static Collection values() { + return values(Category.class); + } +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Impact.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Impact.java new file mode 100644 index 0000000000000..a6d18f572a470 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Impact.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Impact. + */ +public final class Impact extends ExpandableStringEnum { + /** Static value High for Impact. */ + public static final Impact HIGH = fromString("High"); + + /** Static value Medium for Impact. */ + public static final Impact MEDIUM = fromString("Medium"); + + /** Static value Low for Impact. */ + public static final Impact LOW = fromString("Low"); + + /** + * Creates or finds a Impact from its string representation. + * @param name a name to look for + * @return the corresponding Impact + */ + @JsonCreator + public static Impact fromString(String name) { + return fromString(name, Impact.class); + } + + /** + * @return known Impact values + */ + public static Collection values() { + return values(Impact.class); + } +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/OperationDisplayInfo.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/OperationDisplayInfo.java new file mode 100644 index 0000000000000..548f001cbd1e5 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/OperationDisplayInfo.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The operation supported by Advisor. + */ +public class OperationDisplayInfo { + /** + * The description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * The action that users can perform, based on their permission level. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Service provider: Microsoft Advisor. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Get the description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the operation. + * + * @param description the description value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the action that users can perform, based on their permission level. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the action that users can perform, based on their permission level. + * + * @param operation the operation value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get service provider: Microsoft Advisor. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft Advisor. + * + * @param provider the provider value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withResource(String resource) { + this.resource = resource; + return this; + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/OperationEntity.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/OperationEntity.java new file mode 100644 index 0000000000000..0e26a757120f8 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/OperationEntity.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation.AdvisorManager; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation.OperationEntityInner; + +/** + * Type representing OperationEntity. + */ +public interface OperationEntity extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplayInfo display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Operations.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Operations.java new file mode 100644 index 0000000000000..0f700bb8ede4e --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import rx.Observable; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Recommendations.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Recommendations.java new file mode 100644 index 0000000000000..fcd52f1c7683e --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Recommendations.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Observable; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation.RecommendationsInner; +import com.microsoft.azure.arm.model.HasInner; +import rx.Completable; +import java.util.UUID; + +/** + * Type representing Recommendations. + */ +public interface Recommendations extends SupportsListing, HasInner { + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceUri, String recommendationId); + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getGenerateRecommendationsStatusAsync(UUID operationId); + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable generateAsync(); + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/RecommendationsGenerateHeaders.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/RecommendationsGenerateHeaders.java new file mode 100644 index 0000000000000..2782bae298a0b --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/RecommendationsGenerateHeaders.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Generate operation. + */ +public class RecommendationsGenerateHeaders { + /** + * The URL where the status of the asynchronous operation can be checked. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get the URL where the status of the asynchronous operation can be checked. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the URL where the status of the asynchronous operation can be checked. + * + * @param location the location value to set + * @return the RecommendationsGenerateHeaders object itself. + */ + public RecommendationsGenerateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the RecommendationsGenerateHeaders object itself. + */ + public RecommendationsGenerateHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/ResourceRecommendationBase.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/ResourceRecommendationBase.java new file mode 100644 index 0000000000000..7e59ab962cd76 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/ResourceRecommendationBase.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation.ResourceRecommendationBaseInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation.AdvisorManager; +import org.joda.time.DateTime; +import java.util.Map; +import java.util.List; +import java.util.UUID; + +/** + * Type representing ResourceRecommendationBase. + */ +public interface ResourceRecommendationBase extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the category value. + */ + Category category(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the impact value. + */ + Impact impact(); + + /** + * @return the impactedField value. + */ + String impactedField(); + + /** + * @return the impactedValue value. + */ + String impactedValue(); + + /** + * @return the lastUpdated value. + */ + DateTime lastUpdated(); + + /** + * @return the metadata value. + */ + Map metadata(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recommendationTypeId value. + */ + String recommendationTypeId(); + + /** + * @return the risk value. + */ + Risk risk(); + + /** + * @return the shortDescription value. + */ + ShortDescription shortDescription(); + + /** + * @return the suppressionIds value. + */ + List suppressionIds(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Risk.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Risk.java new file mode 100644 index 0000000000000..3dbe7dae60857 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Risk.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Risk. + */ +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 or finds a Risk from its string representation. + * @param name a name to look for + * @return the corresponding Risk + */ + @JsonCreator + public static Risk fromString(String name) { + return fromString(name, Risk.class); + } + + /** + * @return known Risk values + */ + public static Collection values() { + return values(Risk.class); + } +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/ShortDescription.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/ShortDescription.java new file mode 100644 index 0000000000000..10d4434cbb1bf --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/ShortDescription.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A summary of the recommendation. + */ +public class ShortDescription { + /** + * The issue or opportunity identified by the recommendation. + */ + @JsonProperty(value = "problem") + private String problem; + + /** + * The remediation action suggested by the recommendation. + */ + @JsonProperty(value = "solution") + private String solution; + + /** + * Get the issue or opportunity identified by the recommendation. + * + * @return the problem value + */ + public String problem() { + return this.problem; + } + + /** + * Set the issue or opportunity identified by the recommendation. + * + * @param problem the problem value to set + * @return the ShortDescription object itself. + */ + public ShortDescription withProblem(String problem) { + this.problem = problem; + return this; + } + + /** + * Get the remediation action suggested by the recommendation. + * + * @return the solution value + */ + public String solution() { + return this.solution; + } + + /** + * Set the remediation action suggested by the recommendation. + * + * @param solution the solution value to set + * @return the ShortDescription object itself. + */ + public ShortDescription withSolution(String solution) { + this.solution = solution; + return this; + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/SuppressionContract.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/SuppressionContract.java new file mode 100644 index 0000000000000..f1da66bd38ded --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/SuppressionContract.java @@ -0,0 +1,196 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation.SuppressionContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation.AdvisorManager; +import java.util.Map; + +/** + * Type representing SuppressionContract. + */ +public interface SuppressionContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the suppressionId value. + */ + String suppressionId(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the ttl value. + */ + String ttl(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SuppressionContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRecommendation, DefinitionStages.WithResourceUri, DefinitionStages.WithCreate { + } + + /** + * Grouping of SuppressionContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SuppressionContract definition. + */ + interface Blank extends WithRecommendation { + } + + /** + * The stage of the suppressioncontract definition allowing to specify Recommendation. + */ + interface WithRecommendation { + /** + * Specifies recommendationId. + */ + WithResourceUri withExistingRecommendation(String recommendationId); + } + + /** + * The stage of the suppressioncontract definition allowing to specify ResourceUri. + */ + interface WithResourceUri { + /** + * Specifies resourceUri. + */ + WithCreate withResourceUri(String resourceUri); + } + + /** + * The stage of the suppressioncontract definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the suppressioncontract definition allowing to specify SuppressionId. + */ + interface WithSuppressionId { + /** + * Specifies suppressionId. + */ + WithCreate withSuppressionId(String suppressionId); + } + + /** + * The stage of the suppressioncontract definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the suppressioncontract definition allowing to specify Ttl. + */ + interface WithTtl { + /** + * Specifies ttl. + */ + WithCreate withTtl(String ttl); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithLocation, DefinitionStages.WithSuppressionId, DefinitionStages.WithTags, DefinitionStages.WithTtl { + } + } + /** + * The template for a SuppressionContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLocation, UpdateStages.WithSuppressionId, UpdateStages.WithTags, UpdateStages.WithTtl { + } + + /** + * Grouping of SuppressionContract update stages. + */ + interface UpdateStages { + /** + * The stage of the suppressioncontract update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + Update withLocation(String location); + } + + /** + * The stage of the suppressioncontract update allowing to specify SuppressionId. + */ + interface WithSuppressionId { + /** + * Specifies suppressionId. + */ + Update withSuppressionId(String suppressionId); + } + + /** + * The stage of the suppressioncontract update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + Update withTags(Map tags); + } + + /** + * The stage of the suppressioncontract update allowing to specify Ttl. + */ + interface WithTtl { + /** + * Specifies ttl. + */ + Update withTtl(String ttl); + } + + } +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Suppressions.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Suppressions.java new file mode 100644 index 0000000000000..74a1e83f4e0f5 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/Suppressions.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation.SuppressionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Suppressions. + */ +public interface Suppressions extends SupportsCreating, HasInner { + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceUri, String recommendationId, String name); + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceUri, String recommendationId, String name); + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/AdvisorManagementClientImpl.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/AdvisorManagementClientImpl.java new file mode 100644 index 0000000000000..d70ab23d5fc0b --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/AdvisorManagementClientImpl.java @@ -0,0 +1,224 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the AdvisorManagementClientImpl class. + */ +public class AdvisorManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Azure subscription ID. */ + private String subscriptionId; + + /** + * Gets The Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The version of the API to be used with the client request. */ + private String apiVersion; + + /** + * Gets The version of the API to be used with the client request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The RecommendationsInner object to access its operations. + */ + private RecommendationsInner recommendations; + + /** + * Gets the RecommendationsInner object to access its operations. + * @return the RecommendationsInner object. + */ + public RecommendationsInner recommendations() { + return this.recommendations; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The SuppressionsInner object to access its operations. + */ + private SuppressionsInner suppressions; + + /** + * Gets the SuppressionsInner object to access its operations. + * @return the SuppressionsInner object. + */ + public SuppressionsInner suppressions() { + return this.suppressions; + } + + /** + * Initializes an instance of AdvisorManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public AdvisorManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of AdvisorManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AdvisorManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of AdvisorManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public AdvisorManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2016-07-12-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.recommendations = new RecommendationsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.suppressions = new SuppressionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "AdvisorManagementClient", "2016-07-12-preview"); + } +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/AdvisorManager.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/AdvisorManager.java new file mode 100644 index 0000000000000..ed67f923f2eb6 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/AdvisorManager.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Recommendations; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Operations; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Suppressions; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Advisor resource management. + */ +public final class AdvisorManager extends ManagerCore { + private Recommendations recommendations; + private Operations operations; + private Suppressions suppressions; + /** + * Get a Configurable instance that can be used to create AdvisorManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new AdvisorManager.ConfigurableImpl(); + } + /** + * Creates an instance of AdvisorManager that exposes Advisor resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the AdvisorManager + */ + public static AdvisorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new AdvisorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of AdvisorManager that exposes Advisor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the AdvisorManager + */ + public static AdvisorManager authenticate(RestClient restClient, String subscriptionId) { + return new AdvisorManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of AdvisorManager that exposes Advisor management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Advisor management API entry points that work across subscriptions + */ + AdvisorManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Recommendations. + */ + public Recommendations recommendations() { + if (this.recommendations == null) { + this.recommendations = new RecommendationsImpl(this); + } + return this.recommendations; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Suppressions. + */ + public Suppressions suppressions() { + if (this.suppressions == null) { + this.suppressions = new SuppressionsImpl(this); + } + return this.suppressions; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public AdvisorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return AdvisorManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private AdvisorManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new AdvisorManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/IdParsingUtils.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..7bd064725050d --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationEntityImpl.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationEntityImpl.java new file mode 100644 index 0000000000000..26afdb3a13ba1 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationEntityImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.microsoft.azure.management.advisor.v2016_07_12_preview.OperationEntity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.OperationDisplayInfo; + +class OperationEntityImpl extends WrapperImpl implements OperationEntity { + private final AdvisorManager manager; + OperationEntityImpl(OperationEntityInner inner, AdvisorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public AdvisorManager manager() { + return this.manager; + } + + @Override + public OperationDisplayInfo display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationEntityInner.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationEntityInner.java new file mode 100644 index 0000000000000..3203b37518254 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationEntityInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.microsoft.azure.management.advisor.v2016_07_12_preview.OperationDisplayInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The operation supported by Advisor. + */ +public class OperationEntityInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The operation supported by Advisor. + */ + @JsonProperty(value = "display") + private OperationDisplayInfo display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationEntityInner object itself. + */ + public OperationEntityInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the operation supported by Advisor. + * + * @return the display value + */ + public OperationDisplayInfo display() { + return this.display; + } + + /** + * Set the operation supported by Advisor. + * + * @param display the display value to set + * @return the OperationEntityInner object itself. + */ + public OperationEntityInner withDisplay(OperationDisplayInfo display) { + this.display = display; + return this; + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationsImpl.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..722989e3f1569 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.OperationEntity; + +class OperationsImpl extends WrapperImpl implements Operations { + private final AdvisorManager manager; + + OperationsImpl(AdvisorManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public AdvisorManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public OperationEntity call(OperationEntityInner inner) { + return new OperationEntityImpl(inner, manager()); + } + }); + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationsInner.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationsInner.java new file mode 100644 index 0000000000000..5ffe2138d71b4 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private AdvisorManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, AdvisorManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2016_07_12_preview.Operations list" }) + @GET("providers/Microsoft.Advisor/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2016_07_12_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationEntityInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationEntityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationEntityInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationEntityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/PageImpl.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..6621b8ebdcdbf --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/PageImpl1.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/PageImpl1.java new file mode 100644 index 0000000000000..de13b94846515 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/RecommendationsImpl.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/RecommendationsImpl.java new file mode 100644 index 0000000000000..be38ccfedf3cf --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/RecommendationsImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Recommendations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.ResourceRecommendationBase; +import com.microsoft.azure.arm.utils.PagedListConverter; +import rx.Completable; +import java.util.UUID; + +class RecommendationsImpl extends WrapperImpl implements Recommendations { + private PagedListConverter converter; + private final AdvisorManager manager; + + RecommendationsImpl(AdvisorManager manager) { + super(manager.inner().recommendations()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(ResourceRecommendationBaseInner inner) { + return Observable.just((ResourceRecommendationBase) wrapModel(inner)); + } + }; + } + + public AdvisorManager manager() { + return this.manager; + } + + private ResourceRecommendationBaseImpl wrapModel(ResourceRecommendationBaseInner inner) { + return new ResourceRecommendationBaseImpl(inner, manager()); + } + + @Override + public Observable getAsync(String resourceUri, String recommendationId) { + RecommendationsInner client = this.inner(); + return client.getAsync(resourceUri, recommendationId) + .map(new Func1() { + @Override + public ResourceRecommendationBase call(ResourceRecommendationBaseInner inner) { + return new ResourceRecommendationBaseImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + RecommendationsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + RecommendationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ResourceRecommendationBase call(ResourceRecommendationBaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable getGenerateRecommendationsStatusAsync(UUID operationId) { + RecommendationsInner client = this.inner(); + return client.getGenerateRecommendationsStatusAsync(operationId).toCompletable(); + } + + @Override + public Completable generateAsync() { + RecommendationsInner client = this.inner(); + return client.generateAsync().toCompletable(); + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/RecommendationsInner.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/RecommendationsInner.java new file mode 100644 index 0000000000000..bfe72e8b8c418 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/RecommendationsInner.java @@ -0,0 +1,655 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.RecommendationsGenerateHeaders; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Recommendations. + */ +public class RecommendationsInner { + /** The Retrofit service to perform REST calls. */ + private RecommendationsService service; + /** The service client containing this operation class. */ + private AdvisorManagementClientImpl client; + + /** + * Initializes an instance of RecommendationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecommendationsInner(Retrofit retrofit, AdvisorManagementClientImpl client) { + this.service = retrofit.create(RecommendationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Recommendations to be + * used by Retrofit to perform actually REST calls. + */ + interface RecommendationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2016_07_12_preview.Recommendations generate" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations") + Observable> generate(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2016_07_12_preview.Recommendations getGenerateRecommendationsStatus" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}") + Observable> getGenerateRecommendationsStatus(@Path("subscriptionId") String subscriptionId, @Path("operationId") UUID operationId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2016_07_12_preview.Recommendations list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skipToken") String skipToken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2016_07_12_preview.Recommendations get" }) + @GET("{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}") + Observable> get(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2016_07_12_preview.Recommendations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void generate() { + generateWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture generateAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(generateWithServiceResponseAsync(), serviceCallback); + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable generateAsync() { + return generateWithServiceResponseAsync().map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> generateWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.generate(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = generateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders generateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, RecommendationsGenerateHeaders.class); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getGenerateRecommendationsStatus(UUID operationId) { + getGenerateRecommendationsStatusWithServiceResponseAsync(operationId).toBlocking().single().body(); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getGenerateRecommendationsStatusAsync(UUID operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getGenerateRecommendationsStatusWithServiceResponseAsync(operationId), serviceCallback); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable getGenerateRecommendationsStatusAsync(UUID operationId) { + return getGenerateRecommendationsStatusWithServiceResponseAsync(operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> getGenerateRecommendationsStatusWithServiceResponseAsync(UUID operationId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getGenerateRecommendationsStatus(this.client.subscriptionId(), operationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getGenerateRecommendationsStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getGenerateRecommendationsStatusDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceRecommendationBaseInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceRecommendationBaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String skipToken = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), filter, top, skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceRecommendationBaseInner> object if successful. + */ + public PagedList list(final String filter, final Integer top, final String skipToken) { + ServiceResponse> response = listSinglePageAsync(filter, top, skipToken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String filter, final Integer top, final String skipToken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, top, skipToken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable> listAsync(final String filter, final Integer top, final String skipToken) { + return listWithServiceResponseAsync(filter, top, skipToken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final Integer top, final String skipToken) { + return listSinglePageAsync(filter, top, skipToken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + ServiceResponse> * @param filter The filter to apply to the recommendations. + ServiceResponse> * @param top The number of recommendations per page if a paged version of this API is being used. + ServiceResponse> * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceRecommendationBaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final Integer top, final String skipToken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), filter, top, skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceRecommendationBaseInner object if successful. + */ + public ResourceRecommendationBaseInner get(String resourceUri, String recommendationId) { + return getWithServiceResponseAsync(resourceUri, recommendationId).toBlocking().single().body(); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String recommendationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, recommendationId), serviceCallback); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceRecommendationBaseInner object + */ + public Observable getAsync(String resourceUri, String recommendationId) { + return getWithServiceResponseAsync(resourceUri, recommendationId).map(new Func1, ResourceRecommendationBaseInner>() { + @Override + public ResourceRecommendationBaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceRecommendationBaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String recommendationId) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceUri, recommendationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceRecommendationBaseInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceRecommendationBaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/ResourceRecommendationBaseImpl.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/ResourceRecommendationBaseImpl.java new file mode 100644 index 0000000000000..3522f9cd343db --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/ResourceRecommendationBaseImpl.java @@ -0,0 +1,114 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.microsoft.azure.management.advisor.v2016_07_12_preview.ResourceRecommendationBase; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Category; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Impact; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Risk; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.ShortDescription; +import java.util.List; +import java.util.UUID; + +class ResourceRecommendationBaseImpl extends IndexableRefreshableWrapperImpl implements ResourceRecommendationBase { + private String resourceUri; + private String recommendationId; + private final AdvisorManager manager; + + ResourceRecommendationBaseImpl(ResourceRecommendationBaseInner inner, AdvisorManager manager) { + super(null, inner); + this.manager = manager; + this.recommendationId = IdParsingUtils.getValueFromIdByName(inner.id(), "recommendations"); + this.resourceUri = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + } + + @Override + public AdvisorManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RecommendationsInner client = this.manager().inner().recommendations(); + return client.getAsync(this.resourceUri, this.recommendationId); + } + + + + @Override + public Category category() { + return this.inner().category(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Impact impact() { + return this.inner().impact(); + } + + @Override + public String impactedField() { + return this.inner().impactedField(); + } + + @Override + public String impactedValue() { + return this.inner().impactedValue(); + } + + @Override + public DateTime lastUpdated() { + return this.inner().lastUpdated(); + } + + @Override + public Map metadata() { + return this.inner().metadata(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String recommendationTypeId() { + return this.inner().recommendationTypeId(); + } + + @Override + public Risk risk() { + return this.inner().risk(); + } + + @Override + public ShortDescription shortDescription() { + return this.inner().shortDescription(); + } + + @Override + public List suppressionIds() { + return this.inner().suppressionIds(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/ResourceRecommendationBaseInner.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/ResourceRecommendationBaseInner.java new file mode 100644 index 0000000000000..db0d74915b546 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/ResourceRecommendationBaseInner.java @@ -0,0 +1,370 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Category; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Impact; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Risk; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.ShortDescription; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Advisor Recommendation. + */ +@JsonFlatten +public class ResourceRecommendationBaseInner { + /** + * The fully qualified recommendation ID, for example + * /subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.ClassicCompute/virtualMachines/vm1/providers/Microsoft.Advisor/recommendations/recommendationGUID. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The name of recommendation. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The category of the recommendation. Possible values include: + * 'HighAvailability', 'Security', 'Performance', 'Cost'. + */ + @JsonProperty(value = "properties.category") + private Category category; + + /** + * The business impact of the recommendation. Possible values include: + * 'High', 'Medium', 'Low'. + */ + @JsonProperty(value = "properties.impact") + private Impact impact; + + /** + * The resource type identified by Advisor. + */ + @JsonProperty(value = "properties.impactedField") + private String impactedField; + + /** + * The resource identified by Advisor. + */ + @JsonProperty(value = "properties.impactedValue") + private String impactedValue; + + /** + * The most recent time that Advisor checked the validity of the + * recommendation. + */ + @JsonProperty(value = "properties.lastUpdated") + private DateTime lastUpdated; + + /** + * The recommendation metadata. + */ + @JsonProperty(value = "properties.metadata") + private Map metadata; + + /** + * The recommendation-type GUID. + */ + @JsonProperty(value = "properties.recommendationTypeId") + private String recommendationTypeId; + + /** + * The potential risk of not implementing the recommendation. Possible + * values include: 'Error', 'Warning', 'None'. + */ + @JsonProperty(value = "properties.risk") + private Risk risk; + + /** + * A summary of the recommendation. + */ + @JsonProperty(value = "properties.shortDescription") + private ShortDescription shortDescription; + + /** + * The list of snoozed and dismissed rules for the recommendation. + */ + @JsonProperty(value = "suppressionIds") + private List suppressionIds; + + /** + * The recommendation type: Microsoft.Advisor/recommendations. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the fully qualified recommendation ID, for example /subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.ClassicCompute/virtualMachines/vm1/providers/Microsoft.Advisor/recommendations/recommendationGUID. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the fully qualified recommendation ID, for example /subscriptions/subscriptionId/resourceGroups/resourceGroup1/providers/Microsoft.ClassicCompute/virtualMachines/vm1/providers/Microsoft.Advisor/recommendations/recommendationGUID. + * + * @param id the id value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name of recommendation. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of recommendation. + * + * @param name the name value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the category of the recommendation. Possible values include: 'HighAvailability', 'Security', 'Performance', 'Cost'. + * + * @return the category value + */ + public Category category() { + return this.category; + } + + /** + * Set the category of the recommendation. Possible values include: 'HighAvailability', 'Security', 'Performance', 'Cost'. + * + * @param category the category value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withCategory(Category category) { + this.category = category; + return this; + } + + /** + * Get the business impact of the recommendation. Possible values include: 'High', 'Medium', 'Low'. + * + * @return the impact value + */ + public Impact impact() { + return this.impact; + } + + /** + * Set the business impact of the recommendation. Possible values include: 'High', 'Medium', 'Low'. + * + * @param impact the impact value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withImpact(Impact impact) { + this.impact = impact; + return this; + } + + /** + * Get the resource type identified by Advisor. + * + * @return the impactedField value + */ + public String impactedField() { + return this.impactedField; + } + + /** + * Set the resource type identified by Advisor. + * + * @param impactedField the impactedField value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withImpactedField(String impactedField) { + this.impactedField = impactedField; + return this; + } + + /** + * Get the resource identified by Advisor. + * + * @return the impactedValue value + */ + public String impactedValue() { + return this.impactedValue; + } + + /** + * Set the resource identified by Advisor. + * + * @param impactedValue the impactedValue value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withImpactedValue(String impactedValue) { + this.impactedValue = impactedValue; + return this; + } + + /** + * Get the most recent time that Advisor checked the validity of the recommendation. + * + * @return the lastUpdated value + */ + public DateTime lastUpdated() { + return this.lastUpdated; + } + + /** + * Set the most recent time that Advisor checked the validity of the recommendation. + * + * @param lastUpdated the lastUpdated value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withLastUpdated(DateTime lastUpdated) { + this.lastUpdated = lastUpdated; + return this; + } + + /** + * Get the recommendation metadata. + * + * @return the metadata value + */ + public Map metadata() { + return this.metadata; + } + + /** + * Set the recommendation metadata. + * + * @param metadata the metadata value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the recommendation-type GUID. + * + * @return the recommendationTypeId value + */ + public String recommendationTypeId() { + return this.recommendationTypeId; + } + + /** + * Set the recommendation-type GUID. + * + * @param recommendationTypeId the recommendationTypeId value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withRecommendationTypeId(String recommendationTypeId) { + this.recommendationTypeId = recommendationTypeId; + return this; + } + + /** + * Get the potential risk of not implementing the recommendation. Possible values include: 'Error', 'Warning', 'None'. + * + * @return the risk value + */ + public Risk risk() { + return this.risk; + } + + /** + * Set the potential risk of not implementing the recommendation. Possible values include: 'Error', 'Warning', 'None'. + * + * @param risk the risk value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withRisk(Risk risk) { + this.risk = risk; + return this; + } + + /** + * Get a summary of the recommendation. + * + * @return the shortDescription value + */ + public ShortDescription shortDescription() { + return this.shortDescription; + } + + /** + * Set a summary of the recommendation. + * + * @param shortDescription the shortDescription value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withShortDescription(ShortDescription shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Get the list of snoozed and dismissed rules for the recommendation. + * + * @return the suppressionIds value + */ + public List suppressionIds() { + return this.suppressionIds; + } + + /** + * Set the list of snoozed and dismissed rules for the recommendation. + * + * @param suppressionIds the suppressionIds value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withSuppressionIds(List suppressionIds) { + this.suppressionIds = suppressionIds; + return this; + } + + /** + * Get the recommendation type: Microsoft.Advisor/recommendations. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the recommendation type: Microsoft.Advisor/recommendations. + * + * @param type the type value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withType(String type) { + this.type = type; + return this; + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionContractImpl.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionContractImpl.java new file mode 100644 index 0000000000000..3fce6b1ee958b --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionContractImpl.java @@ -0,0 +1,144 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.microsoft.azure.management.advisor.v2016_07_12_preview.SuppressionContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; + +class SuppressionContractImpl extends CreatableUpdatableImpl implements SuppressionContract, SuppressionContract.Definition, SuppressionContract.Update { + private final AdvisorManager manager; + private String resourceUri; + private String recommendationId; + private String name; + + SuppressionContractImpl(String name, AdvisorManager manager) { + super(name, new SuppressionContractInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + SuppressionContractImpl(SuppressionContractInner inner, AdvisorManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.name = inner.name(); + // resource ancestor names + this.recommendationId = IdParsingUtils.getValueFromIdByName(inner.id(), "recommendations"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "suppressions"); + this.resourceUri = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + // + } + + @Override + public AdvisorManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SuppressionsInner client = this.manager().inner().suppressions(); + return client.createAsync(this.resourceUri, this.recommendationId, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SuppressionsInner client = this.manager().inner().suppressions(); + return client.createAsync(this.resourceUri, this.recommendationId, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SuppressionsInner client = this.manager().inner().suppressions(); + return client.getAsync(this.resourceUri, this.recommendationId, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String suppressionId() { + return this.inner().suppressionId(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String ttl() { + return this.inner().ttl(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SuppressionContractImpl withExistingRecommendation(String recommendationId) { + this.recommendationId = recommendationId; + return this; + } + + @Override + public SuppressionContractImpl withResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + @Override + public SuppressionContractImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public SuppressionContractImpl withSuppressionId(String suppressionId) { + this.inner().withSuppressionId(suppressionId); + return this; + } + + @Override + public SuppressionContractImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public SuppressionContractImpl withTtl(String ttl) { + this.inner().withTtl(ttl); + return this; + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionContractInner.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionContractInner.java new file mode 100644 index 0000000000000..198b85750d071 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionContractInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * The details of the snoozed or dismissed rule; for example, the duration, + * name, and GUID associated with the rule. + */ +@SkipParentValidation +public class SuppressionContractInner extends Resource { + /** + * The GUID of the suppression. + */ + @JsonProperty(value = "suppressionId") + private String suppressionId; + + /** + * The duration for which the suppression is valid. + */ + @JsonProperty(value = "ttl") + private String ttl; + + /** + * Get the GUID of the suppression. + * + * @return the suppressionId value + */ + public String suppressionId() { + return this.suppressionId; + } + + /** + * Set the GUID of the suppression. + * + * @param suppressionId the suppressionId value to set + * @return the SuppressionContractInner object itself. + */ + public SuppressionContractInner withSuppressionId(String suppressionId) { + this.suppressionId = suppressionId; + return this; + } + + /** + * Get the duration for which the suppression is valid. + * + * @return the ttl value + */ + public String ttl() { + return this.ttl; + } + + /** + * Set the duration for which the suppression is valid. + * + * @param ttl the ttl value to set + * @return the SuppressionContractInner object itself. + */ + public SuppressionContractInner withTtl(String ttl) { + this.ttl = ttl; + return this; + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionsImpl.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionsImpl.java new file mode 100644 index 0000000000000..da62b89525e4b --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionsImpl.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.Suppressions; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.advisor.v2016_07_12_preview.SuppressionContract; + +class SuppressionsImpl extends WrapperImpl implements Suppressions { + private final AdvisorManager manager; + + SuppressionsImpl(AdvisorManager manager) { + super(manager.inner().suppressions()); + this.manager = manager; + } + + public AdvisorManager manager() { + return this.manager; + } + + @Override + public SuppressionContractImpl define(String name) { + return wrapModel(name); + } + + private SuppressionContractImpl wrapModel(SuppressionContractInner inner) { + return new SuppressionContractImpl(inner, manager()); + } + + private SuppressionContractImpl wrapModel(String name) { + return new SuppressionContractImpl(name, this.manager()); + } + + @Override + public Observable listAsync() { + SuppressionsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public SuppressionContract call(SuppressionContractInner inner) { + return new SuppressionContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceUri, String recommendationId, String name) { + SuppressionsInner client = this.inner(); + return client.getAsync(resourceUri, recommendationId, name) + .map(new Func1() { + @Override + public SuppressionContract call(SuppressionContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceUri, String recommendationId, String name) { + SuppressionsInner client = this.inner(); + return client.deleteAsync(resourceUri, recommendationId, name).toCompletable(); + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionsInner.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionsInner.java new file mode 100644 index 0000000000000..4da8eb4aa8c56 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/SuppressionsInner.java @@ -0,0 +1,437 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Suppressions. + */ +public class SuppressionsInner { + /** The Retrofit service to perform REST calls. */ + private SuppressionsService service; + /** The service client containing this operation class. */ + private AdvisorManagementClientImpl client; + + /** + * Initializes an instance of SuppressionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SuppressionsInner(Retrofit retrofit, AdvisorManagementClientImpl client) { + this.service = retrofit.create(SuppressionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Suppressions to be + * used by Retrofit to perform actually REST calls. + */ + interface SuppressionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2016_07_12_preview.Suppressions get" }) + @GET("{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") + Observable> get(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2016_07_12_preview.Suppressions create" }) + @PUT("{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") + Observable> create(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Path("name") String name, @Body SuppressionContractInner suppressionContract, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2016_07_12_preview.Suppressions delete" }) + @HTTP(path = "{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2016_07_12_preview.Suppressions list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SuppressionContractInner object if successful. + */ + public SuppressionContractInner get(String resourceUri, String recommendationId, String name) { + return getWithServiceResponseAsync(resourceUri, recommendationId, name).toBlocking().single().body(); + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String recommendationId, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, recommendationId, name), serviceCallback); + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable getAsync(String resourceUri, String recommendationId, String name) { + return getWithServiceResponseAsync(resourceUri, recommendationId, name).map(new Func1, SuppressionContractInner>() { + @Override + public SuppressionContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String recommendationId, String name) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceUri, recommendationId, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SuppressionContractInner object if successful. + */ + public SuppressionContractInner create(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract) { + return createWithServiceResponseAsync(resourceUri, recommendationId, name, suppressionContract).toBlocking().single().body(); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceUri, recommendationId, name, suppressionContract), serviceCallback); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable createAsync(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract) { + return createWithServiceResponseAsync(resourceUri, recommendationId, name, suppressionContract).map(new Func1, SuppressionContractInner>() { + @Override + public SuppressionContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable> createWithServiceResponseAsync(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (suppressionContract == null) { + throw new IllegalArgumentException("Parameter suppressionContract is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(suppressionContract); + return service.create(resourceUri, recommendationId, name, suppressionContract, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceUri, String recommendationId, String name) { + deleteWithServiceResponseAsync(resourceUri, recommendationId, name).toBlocking().single().body(); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceUri, String recommendationId, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceUri, recommendationId, name), serviceCallback); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceUri, String recommendationId, String name) { + return deleteWithServiceResponseAsync(resourceUri, recommendationId, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceUri, String recommendationId, String name) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceUri, recommendationId, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @return the observable to the List<SuppressionContractInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @return the observable to the List<SuppressionContractInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/package-info.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/package-info.java new file mode 100644 index 0000000000000..4add881a0ea13 --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for AdvisorManagementClient. + * REST APIs for Azure Advisor. + */ +package com.microsoft.azure.management.advisor.v2016_07_12_preview.implementation; diff --git a/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/package-info.java b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/package-info.java new file mode 100644 index 0000000000000..91eccab3f5d2a --- /dev/null +++ b/advisor/resource-manager/v2016_07_12_preview/src/main/java/com/microsoft/azure/management/advisor/v2016_07_12_preview/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for AdvisorManagementClient. + * REST APIs for Azure Advisor. + */ +package com.microsoft.azure.management.advisor.v2016_07_12_preview; diff --git a/advisor/resource-manager/v2017_03_31/pom.xml b/advisor/resource-manager/v2017_03_31/pom.xml new file mode 100644 index 0000000000000..9e76ca033d1ee --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.advisor.v2017_03_31 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-advisor + 1.0.0-beta + jar + Microsoft Azure SDK for Advisor Management + This package contains Microsoft Advisor Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Category.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Category.java new file mode 100644 index 0000000000000..1ecc67c01ade6 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Category.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Category. + */ +public final class Category extends ExpandableStringEnum { + /** Static value HighAvailability for Category. */ + public static final Category HIGH_AVAILABILITY = fromString("HighAvailability"); + + /** Static value Security for Category. */ + public static final Category SECURITY = fromString("Security"); + + /** Static value Performance for Category. */ + public static final Category PERFORMANCE = fromString("Performance"); + + /** Static value Cost for Category. */ + public static final Category COST = fromString("Cost"); + + /** + * Creates or finds a Category from its string representation. + * @param name a name to look for + * @return the corresponding Category + */ + @JsonCreator + public static Category fromString(String name) { + return fromString(name, Category.class); + } + + /** + * @return known Category values + */ + public static Collection values() { + return values(Category.class); + } +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Impact.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Impact.java new file mode 100644 index 0000000000000..59ff1e1192eee --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Impact.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Impact. + */ +public final class Impact extends ExpandableStringEnum { + /** Static value High for Impact. */ + public static final Impact HIGH = fromString("High"); + + /** Static value Medium for Impact. */ + public static final Impact MEDIUM = fromString("Medium"); + + /** Static value Low for Impact. */ + public static final Impact LOW = fromString("Low"); + + /** + * Creates or finds a Impact from its string representation. + * @param name a name to look for + * @return the corresponding Impact + */ + @JsonCreator + public static Impact fromString(String name) { + return fromString(name, Impact.class); + } + + /** + * @return known Impact values + */ + public static Collection values() { + return values(Impact.class); + } +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/OperationDisplayInfo.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/OperationDisplayInfo.java new file mode 100644 index 0000000000000..4258d981915fc --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/OperationDisplayInfo.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The operation supported by Advisor. + */ +public class OperationDisplayInfo { + /** + * The description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * The action that users can perform, based on their permission level. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Service provider: Microsoft Advisor. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Get the description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the operation. + * + * @param description the description value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the action that users can perform, based on their permission level. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the action that users can perform, based on their permission level. + * + * @param operation the operation value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get service provider: Microsoft Advisor. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft Advisor. + * + * @param provider the provider value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withResource(String resource) { + this.resource = resource; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/OperationEntity.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/OperationEntity.java new file mode 100644 index 0000000000000..c61c3081f11ad --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/OperationEntity.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.advisor.v2017_03_31.implementation.AdvisorManager; +import com.microsoft.azure.management.advisor.v2017_03_31.implementation.OperationEntityInner; + +/** + * Type representing OperationEntity. + */ +public interface OperationEntity extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplayInfo display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Operations.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Operations.java new file mode 100644 index 0000000000000..1f4d659956d74 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import rx.Observable; +import com.microsoft.azure.management.advisor.v2017_03_31.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Recommendations.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Recommendations.java new file mode 100644 index 0000000000000..8e1ed215420b5 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Recommendations.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Observable; +import com.microsoft.azure.management.advisor.v2017_03_31.implementation.RecommendationsInner; +import com.microsoft.azure.arm.model.HasInner; +import rx.Completable; +import java.util.UUID; + +/** + * Type representing Recommendations. + */ +public interface Recommendations extends SupportsListing, HasInner { + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceUri, String recommendationId); + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getGenerateStatusAsync(UUID operationId); + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable generateAsync(); + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/RecommendationsGenerateHeaders.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/RecommendationsGenerateHeaders.java new file mode 100644 index 0000000000000..bed9bf9274698 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/RecommendationsGenerateHeaders.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Generate operation. + */ +public class RecommendationsGenerateHeaders { + /** + * The URL where the status of the asynchronous operation can be checked. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get the URL where the status of the asynchronous operation can be checked. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the URL where the status of the asynchronous operation can be checked. + * + * @param location the location value to set + * @return the RecommendationsGenerateHeaders object itself. + */ + public RecommendationsGenerateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the RecommendationsGenerateHeaders object itself. + */ + public RecommendationsGenerateHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/ResourceRecommendationBase.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/ResourceRecommendationBase.java new file mode 100644 index 0000000000000..e338644930552 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/ResourceRecommendationBase.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.advisor.v2017_03_31.implementation.ResourceRecommendationBaseInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.advisor.v2017_03_31.implementation.AdvisorManager; +import org.joda.time.DateTime; +import java.util.Map; +import java.util.List; +import java.util.UUID; + +/** + * Type representing ResourceRecommendationBase. + */ +public interface ResourceRecommendationBase extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the category value. + */ + Category category(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the impact value. + */ + Impact impact(); + + /** + * @return the impactedField value. + */ + String impactedField(); + + /** + * @return the impactedValue value. + */ + String impactedValue(); + + /** + * @return the lastUpdated value. + */ + DateTime lastUpdated(); + + /** + * @return the metadata value. + */ + Map metadata(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recommendationTypeId value. + */ + String recommendationTypeId(); + + /** + * @return the risk value. + */ + Risk risk(); + + /** + * @return the shortDescription value. + */ + ShortDescription shortDescription(); + + /** + * @return the suppressionIds value. + */ + List suppressionIds(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Risk.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Risk.java new file mode 100644 index 0000000000000..f681ce0a5903e --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Risk.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Risk. + */ +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 or finds a Risk from its string representation. + * @param name a name to look for + * @return the corresponding Risk + */ + @JsonCreator + public static Risk fromString(String name) { + return fromString(name, Risk.class); + } + + /** + * @return known Risk values + */ + public static Collection values() { + return values(Risk.class); + } +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/ShortDescription.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/ShortDescription.java new file mode 100644 index 0000000000000..9cc94d33f9e05 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/ShortDescription.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A summary of the recommendation. + */ +public class ShortDescription { + /** + * The issue or opportunity identified by the recommendation. + */ + @JsonProperty(value = "problem") + private String problem; + + /** + * The remediation action suggested by the recommendation. + */ + @JsonProperty(value = "solution") + private String solution; + + /** + * Get the issue or opportunity identified by the recommendation. + * + * @return the problem value + */ + public String problem() { + return this.problem; + } + + /** + * Set the issue or opportunity identified by the recommendation. + * + * @param problem the problem value to set + * @return the ShortDescription object itself. + */ + public ShortDescription withProblem(String problem) { + this.problem = problem; + return this; + } + + /** + * Get the remediation action suggested by the recommendation. + * + * @return the solution value + */ + public String solution() { + return this.solution; + } + + /** + * Set the remediation action suggested by the recommendation. + * + * @param solution the solution value to set + * @return the ShortDescription object itself. + */ + public ShortDescription withSolution(String solution) { + this.solution = solution; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/SuppressionContract.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/SuppressionContract.java new file mode 100644 index 0000000000000..778fa741ca412 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/SuppressionContract.java @@ -0,0 +1,145 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.advisor.v2017_03_31.implementation.SuppressionContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.advisor.v2017_03_31.implementation.AdvisorManager; + +/** + * Type representing SuppressionContract. + */ +public interface SuppressionContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the suppressionId value. + */ + String suppressionId(); + + /** + * @return the ttl value. + */ + String ttl(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SuppressionContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRecommendation, DefinitionStages.WithResourceUri, DefinitionStages.WithCreate { + } + + /** + * Grouping of SuppressionContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SuppressionContract definition. + */ + interface Blank extends WithRecommendation { + } + + /** + * The stage of the suppressioncontract definition allowing to specify Recommendation. + */ + interface WithRecommendation { + /** + * Specifies recommendationId. + */ + WithResourceUri withExistingRecommendation(String recommendationId); + } + + /** + * The stage of the suppressioncontract definition allowing to specify ResourceUri. + */ + interface WithResourceUri { + /** + * Specifies resourceUri. + */ + WithCreate withResourceUri(String resourceUri); + } + + /** + * The stage of the suppressioncontract definition allowing to specify SuppressionId. + */ + interface WithSuppressionId { + /** + * Specifies suppressionId. + */ + WithCreate withSuppressionId(String suppressionId); + } + + /** + * The stage of the suppressioncontract definition allowing to specify Ttl. + */ + interface WithTtl { + /** + * Specifies ttl. + */ + WithCreate withTtl(String ttl); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithSuppressionId, DefinitionStages.WithTtl { + } + } + /** + * The template for a SuppressionContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithSuppressionId, UpdateStages.WithTtl { + } + + /** + * Grouping of SuppressionContract update stages. + */ + interface UpdateStages { + /** + * The stage of the suppressioncontract update allowing to specify SuppressionId. + */ + interface WithSuppressionId { + /** + * Specifies suppressionId. + */ + Update withSuppressionId(String suppressionId); + } + + /** + * The stage of the suppressioncontract update allowing to specify Ttl. + */ + interface WithTtl { + /** + * Specifies ttl. + */ + Update withTtl(String ttl); + } + + } +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Suppressions.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Suppressions.java new file mode 100644 index 0000000000000..9f9ea02c8019a --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/Suppressions.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.advisor.v2017_03_31.implementation.SuppressionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Suppressions. + */ +public interface Suppressions extends SupportsCreating, HasInner { + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceUri, String recommendationId, String name); + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceUri, String recommendationId, String name); + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/AdvisorManagementClientImpl.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/AdvisorManagementClientImpl.java new file mode 100644 index 0000000000000..2873756fb11c9 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/AdvisorManagementClientImpl.java @@ -0,0 +1,224 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the AdvisorManagementClientImpl class. + */ +public class AdvisorManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Azure subscription ID. */ + private String subscriptionId; + + /** + * Gets The Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The version of the API to be used with the client request. */ + private String apiVersion; + + /** + * Gets The version of the API to be used with the client request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The RecommendationsInner object to access its operations. + */ + private RecommendationsInner recommendations; + + /** + * Gets the RecommendationsInner object to access its operations. + * @return the RecommendationsInner object. + */ + public RecommendationsInner recommendations() { + return this.recommendations; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The SuppressionsInner object to access its operations. + */ + private SuppressionsInner suppressions; + + /** + * Gets the SuppressionsInner object to access its operations. + * @return the SuppressionsInner object. + */ + public SuppressionsInner suppressions() { + return this.suppressions; + } + + /** + * Initializes an instance of AdvisorManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public AdvisorManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of AdvisorManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AdvisorManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of AdvisorManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public AdvisorManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-03-31"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.recommendations = new RecommendationsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.suppressions = new SuppressionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "AdvisorManagementClient", "2017-03-31"); + } +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/AdvisorManager.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/AdvisorManager.java new file mode 100644 index 0000000000000..1852b59fbb9c9 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/AdvisorManager.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.advisor.v2017_03_31.Recommendations; +import com.microsoft.azure.management.advisor.v2017_03_31.Operations; +import com.microsoft.azure.management.advisor.v2017_03_31.Suppressions; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Advisor resource management. + */ +public final class AdvisorManager extends ManagerCore { + private Recommendations recommendations; + private Operations operations; + private Suppressions suppressions; + /** + * Get a Configurable instance that can be used to create AdvisorManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new AdvisorManager.ConfigurableImpl(); + } + /** + * Creates an instance of AdvisorManager that exposes Advisor resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the AdvisorManager + */ + public static AdvisorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new AdvisorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of AdvisorManager that exposes Advisor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the AdvisorManager + */ + public static AdvisorManager authenticate(RestClient restClient, String subscriptionId) { + return new AdvisorManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of AdvisorManager that exposes Advisor management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Advisor management API entry points that work across subscriptions + */ + AdvisorManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Recommendations. + */ + public Recommendations recommendations() { + if (this.recommendations == null) { + this.recommendations = new RecommendationsImpl(this); + } + return this.recommendations; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Suppressions. + */ + public Suppressions suppressions() { + if (this.suppressions == null) { + this.suppressions = new SuppressionsImpl(this); + } + return this.suppressions; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public AdvisorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return AdvisorManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private AdvisorManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new AdvisorManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/IdParsingUtils.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..3e5f7e0d50215 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationEntityImpl.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationEntityImpl.java new file mode 100644 index 0000000000000..fe73071aaad1e --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationEntityImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.microsoft.azure.management.advisor.v2017_03_31.OperationEntity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2017_03_31.OperationDisplayInfo; + +class OperationEntityImpl extends WrapperImpl implements OperationEntity { + private final AdvisorManager manager; + OperationEntityImpl(OperationEntityInner inner, AdvisorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public AdvisorManager manager() { + return this.manager; + } + + @Override + public OperationDisplayInfo display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationEntityInner.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationEntityInner.java new file mode 100644 index 0000000000000..b0f78fe23efe6 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationEntityInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.microsoft.azure.management.advisor.v2017_03_31.OperationDisplayInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The operation supported by Advisor. + */ +public class OperationEntityInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The operation supported by Advisor. + */ + @JsonProperty(value = "display") + private OperationDisplayInfo display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationEntityInner object itself. + */ + public OperationEntityInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the operation supported by Advisor. + * + * @return the display value + */ + public OperationDisplayInfo display() { + return this.display; + } + + /** + * Set the operation supported by Advisor. + * + * @param display the display value to set + * @return the OperationEntityInner object itself. + */ + public OperationEntityInner withDisplay(OperationDisplayInfo display) { + this.display = display; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationsImpl.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..877600676b1b0 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2017_03_31.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.advisor.v2017_03_31.OperationEntity; + +class OperationsImpl extends WrapperImpl implements Operations { + private final AdvisorManager manager; + + OperationsImpl(AdvisorManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public AdvisorManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public OperationEntity call(OperationEntityInner inner) { + return new OperationEntityImpl(inner, manager()); + } + }); + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationsInner.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationsInner.java new file mode 100644 index 0000000000000..875790742bf27 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private AdvisorManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, AdvisorManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_03_31.Operations list" }) + @GET("providers/Microsoft.Advisor/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_03_31.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationEntityInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationEntityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationEntityInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationEntityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/PageImpl.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/PageImpl.java new file mode 100644 index 0000000000000..779d992792641 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/PageImpl1.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/PageImpl1.java new file mode 100644 index 0000000000000..84d2c81e16438 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/RecommendationsImpl.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/RecommendationsImpl.java new file mode 100644 index 0000000000000..d16c9a360ee6b --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/RecommendationsImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2017_03_31.Recommendations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.advisor.v2017_03_31.ResourceRecommendationBase; +import com.microsoft.azure.arm.utils.PagedListConverter; +import rx.Completable; +import java.util.UUID; + +class RecommendationsImpl extends WrapperImpl implements Recommendations { + private PagedListConverter converter; + private final AdvisorManager manager; + + RecommendationsImpl(AdvisorManager manager) { + super(manager.inner().recommendations()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(ResourceRecommendationBaseInner inner) { + return Observable.just((ResourceRecommendationBase) wrapModel(inner)); + } + }; + } + + public AdvisorManager manager() { + return this.manager; + } + + private ResourceRecommendationBaseImpl wrapModel(ResourceRecommendationBaseInner inner) { + return new ResourceRecommendationBaseImpl(inner, manager()); + } + + @Override + public Observable getAsync(String resourceUri, String recommendationId) { + RecommendationsInner client = this.inner(); + return client.getAsync(resourceUri, recommendationId) + .map(new Func1() { + @Override + public ResourceRecommendationBase call(ResourceRecommendationBaseInner inner) { + return new ResourceRecommendationBaseImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + RecommendationsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + RecommendationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ResourceRecommendationBase call(ResourceRecommendationBaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable getGenerateStatusAsync(UUID operationId) { + RecommendationsInner client = this.inner(); + return client.getGenerateStatusAsync(operationId).toCompletable(); + } + + @Override + public Completable generateAsync() { + RecommendationsInner client = this.inner(); + return client.generateAsync().toCompletable(); + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/RecommendationsInner.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/RecommendationsInner.java new file mode 100644 index 0000000000000..eceadc055b2b2 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/RecommendationsInner.java @@ -0,0 +1,655 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.advisor.v2017_03_31.RecommendationsGenerateHeaders; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Recommendations. + */ +public class RecommendationsInner { + /** The Retrofit service to perform REST calls. */ + private RecommendationsService service; + /** The service client containing this operation class. */ + private AdvisorManagementClientImpl client; + + /** + * Initializes an instance of RecommendationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecommendationsInner(Retrofit retrofit, AdvisorManagementClientImpl client) { + this.service = retrofit.create(RecommendationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Recommendations to be + * used by Retrofit to perform actually REST calls. + */ + interface RecommendationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_03_31.Recommendations generate" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations") + Observable> generate(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_03_31.Recommendations getGenerateStatus" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}") + Observable> getGenerateStatus(@Path("subscriptionId") String subscriptionId, @Path("operationId") UUID operationId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_03_31.Recommendations list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skipToken") String skipToken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_03_31.Recommendations get" }) + @GET("{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}") + Observable> get(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_03_31.Recommendations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void generate() { + generateWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture generateAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(generateWithServiceResponseAsync(), serviceCallback); + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable generateAsync() { + return generateWithServiceResponseAsync().map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> generateWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.generate(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = generateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders generateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, RecommendationsGenerateHeaders.class); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getGenerateStatus(UUID operationId) { + getGenerateStatusWithServiceResponseAsync(operationId).toBlocking().single().body(); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getGenerateStatusAsync(UUID operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getGenerateStatusWithServiceResponseAsync(operationId), serviceCallback); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable getGenerateStatusAsync(UUID operationId) { + return getGenerateStatusWithServiceResponseAsync(operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> getGenerateStatusWithServiceResponseAsync(UUID operationId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getGenerateStatus(this.client.subscriptionId(), operationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getGenerateStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getGenerateStatusDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceRecommendationBaseInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceRecommendationBaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String skipToken = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), filter, top, skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceRecommendationBaseInner> object if successful. + */ + public PagedList list(final String filter, final Integer top, final String skipToken) { + ServiceResponse> response = listSinglePageAsync(filter, top, skipToken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String filter, final Integer top, final String skipToken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, top, skipToken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable> listAsync(final String filter, final Integer top, final String skipToken) { + return listWithServiceResponseAsync(filter, top, skipToken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final Integer top, final String skipToken) { + return listSinglePageAsync(filter, top, skipToken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + ServiceResponse> * @param filter The filter to apply to the recommendations. + ServiceResponse> * @param top The number of recommendations per page if a paged version of this API is being used. + ServiceResponse> * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceRecommendationBaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final Integer top, final String skipToken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), filter, top, skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceRecommendationBaseInner object if successful. + */ + public ResourceRecommendationBaseInner get(String resourceUri, String recommendationId) { + return getWithServiceResponseAsync(resourceUri, recommendationId).toBlocking().single().body(); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String recommendationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, recommendationId), serviceCallback); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceRecommendationBaseInner object + */ + public Observable getAsync(String resourceUri, String recommendationId) { + return getWithServiceResponseAsync(resourceUri, recommendationId).map(new Func1, ResourceRecommendationBaseInner>() { + @Override + public ResourceRecommendationBaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceRecommendationBaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String recommendationId) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceUri, recommendationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceRecommendationBaseInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceRecommendationBaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/ResourceRecommendationBaseImpl.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/ResourceRecommendationBaseImpl.java new file mode 100644 index 0000000000000..60fdba0f77119 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/ResourceRecommendationBaseImpl.java @@ -0,0 +1,114 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.microsoft.azure.management.advisor.v2017_03_31.ResourceRecommendationBase; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.advisor.v2017_03_31.Category; +import com.microsoft.azure.management.advisor.v2017_03_31.Impact; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.advisor.v2017_03_31.Risk; +import com.microsoft.azure.management.advisor.v2017_03_31.ShortDescription; +import java.util.List; +import java.util.UUID; + +class ResourceRecommendationBaseImpl extends IndexableRefreshableWrapperImpl implements ResourceRecommendationBase { + private String resourceUri; + private String recommendationId; + private final AdvisorManager manager; + + ResourceRecommendationBaseImpl(ResourceRecommendationBaseInner inner, AdvisorManager manager) { + super(null, inner); + this.manager = manager; + this.recommendationId = IdParsingUtils.getValueFromIdByName(inner.id(), "recommendations"); + this.resourceUri = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + } + + @Override + public AdvisorManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RecommendationsInner client = this.manager().inner().recommendations(); + return client.getAsync(this.resourceUri, this.recommendationId); + } + + + + @Override + public Category category() { + return this.inner().category(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Impact impact() { + return this.inner().impact(); + } + + @Override + public String impactedField() { + return this.inner().impactedField(); + } + + @Override + public String impactedValue() { + return this.inner().impactedValue(); + } + + @Override + public DateTime lastUpdated() { + return this.inner().lastUpdated(); + } + + @Override + public Map metadata() { + return this.inner().metadata(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String recommendationTypeId() { + return this.inner().recommendationTypeId(); + } + + @Override + public Risk risk() { + return this.inner().risk(); + } + + @Override + public ShortDescription shortDescription() { + return this.inner().shortDescription(); + } + + @Override + public List suppressionIds() { + return this.inner().suppressionIds(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/ResourceRecommendationBaseInner.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/ResourceRecommendationBaseInner.java new file mode 100644 index 0000000000000..3bbca28dba091 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/ResourceRecommendationBaseInner.java @@ -0,0 +1,292 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.microsoft.azure.management.advisor.v2017_03_31.Category; +import com.microsoft.azure.management.advisor.v2017_03_31.Impact; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.advisor.v2017_03_31.Risk; +import com.microsoft.azure.management.advisor.v2017_03_31.ShortDescription; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Advisor Recommendation. + */ +@JsonFlatten +public class ResourceRecommendationBaseInner extends ProxyResource { + /** + * The category of the recommendation. Possible values include: + * 'HighAvailability', 'Security', 'Performance', 'Cost'. + */ + @JsonProperty(value = "properties.category") + private Category category; + + /** + * The business impact of the recommendation. Possible values include: + * 'High', 'Medium', 'Low'. + */ + @JsonProperty(value = "properties.impact") + private Impact impact; + + /** + * The resource type identified by Advisor. + */ + @JsonProperty(value = "properties.impactedField") + private String impactedField; + + /** + * The resource identified by Advisor. + */ + @JsonProperty(value = "properties.impactedValue") + private String impactedValue; + + /** + * The most recent time that Advisor checked the validity of the + * recommendation. + */ + @JsonProperty(value = "properties.lastUpdated") + private DateTime lastUpdated; + + /** + * The recommendation metadata. + */ + @JsonProperty(value = "properties.metadata") + private Map metadata; + + /** + * The recommendation-type GUID. + */ + @JsonProperty(value = "properties.recommendationTypeId") + private String recommendationTypeId; + + /** + * The potential risk of not implementing the recommendation. Possible + * values include: 'Error', 'Warning', 'None'. + */ + @JsonProperty(value = "properties.risk") + private Risk risk; + + /** + * A summary of the recommendation. + */ + @JsonProperty(value = "properties.shortDescription") + private ShortDescription shortDescription; + + /** + * The list of snoozed and dismissed rules for the recommendation. + */ + @JsonProperty(value = "properties.suppressionIds") + private List suppressionIds; + + /** + * Get the category of the recommendation. Possible values include: 'HighAvailability', 'Security', 'Performance', 'Cost'. + * + * @return the category value + */ + public Category category() { + return this.category; + } + + /** + * Set the category of the recommendation. Possible values include: 'HighAvailability', 'Security', 'Performance', 'Cost'. + * + * @param category the category value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withCategory(Category category) { + this.category = category; + return this; + } + + /** + * Get the business impact of the recommendation. Possible values include: 'High', 'Medium', 'Low'. + * + * @return the impact value + */ + public Impact impact() { + return this.impact; + } + + /** + * Set the business impact of the recommendation. Possible values include: 'High', 'Medium', 'Low'. + * + * @param impact the impact value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withImpact(Impact impact) { + this.impact = impact; + return this; + } + + /** + * Get the resource type identified by Advisor. + * + * @return the impactedField value + */ + public String impactedField() { + return this.impactedField; + } + + /** + * Set the resource type identified by Advisor. + * + * @param impactedField the impactedField value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withImpactedField(String impactedField) { + this.impactedField = impactedField; + return this; + } + + /** + * Get the resource identified by Advisor. + * + * @return the impactedValue value + */ + public String impactedValue() { + return this.impactedValue; + } + + /** + * Set the resource identified by Advisor. + * + * @param impactedValue the impactedValue value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withImpactedValue(String impactedValue) { + this.impactedValue = impactedValue; + return this; + } + + /** + * Get the most recent time that Advisor checked the validity of the recommendation. + * + * @return the lastUpdated value + */ + public DateTime lastUpdated() { + return this.lastUpdated; + } + + /** + * Set the most recent time that Advisor checked the validity of the recommendation. + * + * @param lastUpdated the lastUpdated value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withLastUpdated(DateTime lastUpdated) { + this.lastUpdated = lastUpdated; + return this; + } + + /** + * Get the recommendation metadata. + * + * @return the metadata value + */ + public Map metadata() { + return this.metadata; + } + + /** + * Set the recommendation metadata. + * + * @param metadata the metadata value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the recommendation-type GUID. + * + * @return the recommendationTypeId value + */ + public String recommendationTypeId() { + return this.recommendationTypeId; + } + + /** + * Set the recommendation-type GUID. + * + * @param recommendationTypeId the recommendationTypeId value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withRecommendationTypeId(String recommendationTypeId) { + this.recommendationTypeId = recommendationTypeId; + return this; + } + + /** + * Get the potential risk of not implementing the recommendation. Possible values include: 'Error', 'Warning', 'None'. + * + * @return the risk value + */ + public Risk risk() { + return this.risk; + } + + /** + * Set the potential risk of not implementing the recommendation. Possible values include: 'Error', 'Warning', 'None'. + * + * @param risk the risk value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withRisk(Risk risk) { + this.risk = risk; + return this; + } + + /** + * Get a summary of the recommendation. + * + * @return the shortDescription value + */ + public ShortDescription shortDescription() { + return this.shortDescription; + } + + /** + * Set a summary of the recommendation. + * + * @param shortDescription the shortDescription value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withShortDescription(ShortDescription shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Get the list of snoozed and dismissed rules for the recommendation. + * + * @return the suppressionIds value + */ + public List suppressionIds() { + return this.suppressionIds; + } + + /** + * Set the list of snoozed and dismissed rules for the recommendation. + * + * @param suppressionIds the suppressionIds value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withSuppressionIds(List suppressionIds) { + this.suppressionIds = suppressionIds; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionContractImpl.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionContractImpl.java new file mode 100644 index 0000000000000..da3c846a95e3b --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionContractImpl.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.microsoft.azure.management.advisor.v2017_03_31.SuppressionContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class SuppressionContractImpl extends CreatableUpdatableImpl implements SuppressionContract, SuppressionContract.Definition, SuppressionContract.Update { + private final AdvisorManager manager; + private String resourceUri; + private String recommendationId; + private String name; + + SuppressionContractImpl(String name, AdvisorManager manager) { + super(name, new SuppressionContractInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + SuppressionContractImpl(SuppressionContractInner inner, AdvisorManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.name = inner.name(); + // resource ancestor names + this.recommendationId = IdParsingUtils.getValueFromIdByName(inner.id(), "recommendations"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "suppressions"); + this.resourceUri = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + // + } + + @Override + public AdvisorManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SuppressionsInner client = this.manager().inner().suppressions(); + return client.createAsync(this.resourceUri, this.recommendationId, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SuppressionsInner client = this.manager().inner().suppressions(); + return client.createAsync(this.resourceUri, this.recommendationId, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SuppressionsInner client = this.manager().inner().suppressions(); + return client.getAsync(this.resourceUri, this.recommendationId, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String suppressionId() { + return this.inner().suppressionId(); + } + + @Override + public String ttl() { + return this.inner().ttl(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SuppressionContractImpl withExistingRecommendation(String recommendationId) { + this.recommendationId = recommendationId; + return this; + } + + @Override + public SuppressionContractImpl withResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + @Override + public SuppressionContractImpl withSuppressionId(String suppressionId) { + this.inner().withSuppressionId(suppressionId); + return this; + } + + @Override + public SuppressionContractImpl withTtl(String ttl) { + this.inner().withTtl(ttl); + return this; + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionContractInner.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionContractInner.java new file mode 100644 index 0000000000000..c07ff5aa0d02d --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionContractInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The details of the snoozed or dismissed rule; for example, the duration, + * name, and GUID associated with the rule. + */ +@JsonFlatten +public class SuppressionContractInner extends ProxyResource { + /** + * The GUID of the suppression. + */ + @JsonProperty(value = "properties.suppressionId") + private String suppressionId; + + /** + * The duration for which the suppression is valid. + */ + @JsonProperty(value = "properties.ttl") + private String ttl; + + /** + * Get the GUID of the suppression. + * + * @return the suppressionId value + */ + public String suppressionId() { + return this.suppressionId; + } + + /** + * Set the GUID of the suppression. + * + * @param suppressionId the suppressionId value to set + * @return the SuppressionContractInner object itself. + */ + public SuppressionContractInner withSuppressionId(String suppressionId) { + this.suppressionId = suppressionId; + return this; + } + + /** + * Get the duration for which the suppression is valid. + * + * @return the ttl value + */ + public String ttl() { + return this.ttl; + } + + /** + * Set the duration for which the suppression is valid. + * + * @param ttl the ttl value to set + * @return the SuppressionContractInner object itself. + */ + public SuppressionContractInner withTtl(String ttl) { + this.ttl = ttl; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionsImpl.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionsImpl.java new file mode 100644 index 0000000000000..a1f4a5b3a5136 --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionsImpl.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2017_03_31.Suppressions; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.advisor.v2017_03_31.SuppressionContract; + +class SuppressionsImpl extends WrapperImpl implements Suppressions { + private final AdvisorManager manager; + + SuppressionsImpl(AdvisorManager manager) { + super(manager.inner().suppressions()); + this.manager = manager; + } + + public AdvisorManager manager() { + return this.manager; + } + + @Override + public SuppressionContractImpl define(String name) { + return wrapModel(name); + } + + private SuppressionContractImpl wrapModel(SuppressionContractInner inner) { + return new SuppressionContractImpl(inner, manager()); + } + + private SuppressionContractImpl wrapModel(String name) { + return new SuppressionContractImpl(name, this.manager()); + } + + @Override + public Observable listAsync() { + SuppressionsInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public SuppressionContract call(SuppressionContractInner inner) { + return new SuppressionContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceUri, String recommendationId, String name) { + SuppressionsInner client = this.inner(); + return client.getAsync(resourceUri, recommendationId, name) + .map(new Func1() { + @Override + public SuppressionContract call(SuppressionContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceUri, String recommendationId, String name) { + SuppressionsInner client = this.inner(); + return client.deleteAsync(resourceUri, recommendationId, name).toCompletable(); + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionsInner.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionsInner.java new file mode 100644 index 0000000000000..25a91684b396b --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/SuppressionsInner.java @@ -0,0 +1,437 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Suppressions. + */ +public class SuppressionsInner { + /** The Retrofit service to perform REST calls. */ + private SuppressionsService service; + /** The service client containing this operation class. */ + private AdvisorManagementClientImpl client; + + /** + * Initializes an instance of SuppressionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SuppressionsInner(Retrofit retrofit, AdvisorManagementClientImpl client) { + this.service = retrofit.create(SuppressionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Suppressions to be + * used by Retrofit to perform actually REST calls. + */ + interface SuppressionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_03_31.Suppressions get" }) + @GET("{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") + Observable> get(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_03_31.Suppressions create" }) + @PUT("{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") + Observable> create(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Path("name") String name, @Body SuppressionContractInner suppressionContract, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_03_31.Suppressions delete" }) + @HTTP(path = "{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_03_31.Suppressions list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SuppressionContractInner object if successful. + */ + public SuppressionContractInner get(String resourceUri, String recommendationId, String name) { + return getWithServiceResponseAsync(resourceUri, recommendationId, name).toBlocking().single().body(); + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String recommendationId, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, recommendationId, name), serviceCallback); + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable getAsync(String resourceUri, String recommendationId, String name) { + return getWithServiceResponseAsync(resourceUri, recommendationId, name).map(new Func1, SuppressionContractInner>() { + @Override + public SuppressionContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String recommendationId, String name) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceUri, recommendationId, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SuppressionContractInner object if successful. + */ + public SuppressionContractInner create(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract) { + return createWithServiceResponseAsync(resourceUri, recommendationId, name, suppressionContract).toBlocking().single().body(); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceUri, recommendationId, name, suppressionContract), serviceCallback); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable createAsync(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract) { + return createWithServiceResponseAsync(resourceUri, recommendationId, name, suppressionContract).map(new Func1, SuppressionContractInner>() { + @Override + public SuppressionContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable> createWithServiceResponseAsync(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (suppressionContract == null) { + throw new IllegalArgumentException("Parameter suppressionContract is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(suppressionContract); + return service.create(resourceUri, recommendationId, name, suppressionContract, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceUri, String recommendationId, String name) { + deleteWithServiceResponseAsync(resourceUri, recommendationId, name).toBlocking().single().body(); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceUri, String recommendationId, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceUri, recommendationId, name), serviceCallback); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceUri, String recommendationId, String name) { + return deleteWithServiceResponseAsync(resourceUri, recommendationId, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceUri, String recommendationId, String name) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceUri, recommendationId, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @return the observable to the List<SuppressionContractInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @return the observable to the List<SuppressionContractInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/package-info.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/package-info.java new file mode 100644 index 0000000000000..46efcd59fe04d --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for AdvisorManagementClient. + * REST APIs for Azure Advisor. + */ +package com.microsoft.azure.management.advisor.v2017_03_31.implementation; diff --git a/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/package-info.java b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/package-info.java new file mode 100644 index 0000000000000..e0344a45fb43d --- /dev/null +++ b/advisor/resource-manager/v2017_03_31/src/main/java/com/microsoft/azure/management/advisor/v2017_03_31/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for AdvisorManagementClient. + * REST APIs for Azure Advisor. + */ +package com.microsoft.azure.management.advisor.v2017_03_31; diff --git a/advisor/resource-manager/v2017_04_19/pom.xml b/advisor/resource-manager/v2017_04_19/pom.xml new file mode 100644 index 0000000000000..d9b174b6f450d --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.advisor.v2017_04_19 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-advisor + 1.0.0-beta + jar + Microsoft Azure SDK for Advisor Management + This package contains Microsoft Advisor Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ARMErrorResponseBody.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ARMErrorResponseBody.java new file mode 100644 index 0000000000000..c9ab8b8570ad1 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ARMErrorResponseBody.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.AdvisorManager; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.ARMErrorResponseBodyInner; + +/** + * Type representing ARMErrorResponseBody. + */ +public interface ARMErrorResponseBody extends HasInner, HasManager { + /** + * @return the code value. + */ + String code(); + + /** + * @return the message value. + */ + String message(); + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Category.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Category.java new file mode 100644 index 0000000000000..2e55631173286 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Category.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Category. + */ +public final class Category extends ExpandableStringEnum { + /** Static value HighAvailability for Category. */ + public static final Category HIGH_AVAILABILITY = fromString("HighAvailability"); + + /** Static value Security for Category. */ + public static final Category SECURITY = fromString("Security"); + + /** Static value Performance for Category. */ + public static final Category PERFORMANCE = fromString("Performance"); + + /** Static value Cost for Category. */ + public static final Category COST = fromString("Cost"); + + /** + * Creates or finds a Category from its string representation. + * @param name a name to look for + * @return the corresponding Category + */ + @JsonCreator + public static Category fromString(String name) { + return fromString(name, Category.class); + } + + /** + * @return known Category values + */ + public static Collection values() { + return values(Category.class); + } +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ConfigData.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ConfigData.java new file mode 100644 index 0000000000000..8c4a4a59090f3 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ConfigData.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.ConfigDataInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.AdvisorManager; + +/** + * Type representing ConfigData. + */ +public interface ConfigData extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + ConfigDataProperties properties(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ConfigDataProperties.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ConfigDataProperties.java new file mode 100644 index 0000000000000..103a8046004f2 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ConfigDataProperties.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of property name/value pairs. + */ +public class ConfigDataProperties { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Exclude the resource from Advisor evaluations. Valid values: False + * (default) or True. + */ + @JsonProperty(value = "exclude") + private Boolean exclude; + + /** + * Minimum percentage threshold for Advisor low CPU utilization evaluation. + * Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20. + */ + @JsonProperty(value = "low_cpu_threshold") + private String lowCpuThreshold; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ConfigDataProperties object itself. + */ + public ConfigDataProperties withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get exclude the resource from Advisor evaluations. Valid values: False (default) or True. + * + * @return the exclude value + */ + public Boolean exclude() { + return this.exclude; + } + + /** + * Set exclude the resource from Advisor evaluations. Valid values: False (default) or True. + * + * @param exclude the exclude value to set + * @return the ConfigDataProperties object itself. + */ + public ConfigDataProperties withExclude(Boolean exclude) { + this.exclude = exclude; + return this; + } + + /** + * Get minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20. + * + * @return the lowCpuThreshold value + */ + public String lowCpuThreshold() { + return this.lowCpuThreshold; + } + + /** + * Set minimum percentage threshold for Advisor low CPU utilization evaluation. Valid only for subscriptions. Valid values: 5 (default), 10, 15 or 20. + * + * @param lowCpuThreshold the lowCpuThreshold value to set + * @return the ConfigDataProperties object itself. + */ + public ConfigDataProperties withLowCpuThreshold(String lowCpuThreshold) { + this.lowCpuThreshold = lowCpuThreshold; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Configurations.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Configurations.java new file mode 100644 index 0000000000000..cb7fcfdb39fb6 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Configurations.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Observable; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.ConfigDataInner; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.ConfigurationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Configurations. + */ +public interface Configurations extends SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Create/Overwrite Azure Advisor configuration. + * Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + * + * @param configContract The Azure Advisor configuration data structure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createInSubscriptionAsync(ConfigDataInner configContract); + + /** + * Create/Overwrite Azure Advisor configuration. + * + * @param resourceGroup The name of the Azure resource group. + * @param configContract The Azure Advisor configuration data structure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createInResourceGroupAsync(String resourceGroup, ConfigDataInner configContract); + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Impact.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Impact.java new file mode 100644 index 0000000000000..57bbb92533ce6 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Impact.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Impact. + */ +public final class Impact extends ExpandableStringEnum { + /** Static value High for Impact. */ + public static final Impact HIGH = fromString("High"); + + /** Static value Medium for Impact. */ + public static final Impact MEDIUM = fromString("Medium"); + + /** Static value Low for Impact. */ + public static final Impact LOW = fromString("Low"); + + /** + * Creates or finds a Impact from its string representation. + * @param name a name to look for + * @return the corresponding Impact + */ + @JsonCreator + public static Impact fromString(String name) { + return fromString(name, Impact.class); + } + + /** + * @return known Impact values + */ + public static Collection values() { + return values(Impact.class); + } +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/OperationDisplayInfo.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/OperationDisplayInfo.java new file mode 100644 index 0000000000000..f6bc9c5cb4afd --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/OperationDisplayInfo.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The operation supported by Advisor. + */ +public class OperationDisplayInfo { + /** + * The description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * The action that users can perform, based on their permission level. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Service provider: Microsoft Advisor. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Get the description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the operation. + * + * @param description the description value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the action that users can perform, based on their permission level. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the action that users can perform, based on their permission level. + * + * @param operation the operation value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get service provider: Microsoft Advisor. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft Advisor. + * + * @param provider the provider value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplayInfo object itself. + */ + public OperationDisplayInfo withResource(String resource) { + this.resource = resource; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/OperationEntity.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/OperationEntity.java new file mode 100644 index 0000000000000..b24ba509c702a --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/OperationEntity.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.AdvisorManager; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.OperationEntityInner; + +/** + * Type representing OperationEntity. + */ +public interface OperationEntity extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplayInfo display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Operations.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Operations.java new file mode 100644 index 0000000000000..ee8ba0b6e7ac7 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import rx.Observable; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Recommendations.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Recommendations.java new file mode 100644 index 0000000000000..90420da371d46 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Recommendations.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Observable; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.RecommendationsInner; +import com.microsoft.azure.arm.model.HasInner; +import rx.Completable; +import java.util.UUID; + +/** + * Type representing Recommendations. + */ +public interface Recommendations extends SupportsListing, HasInner { + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceUri, String recommendationId); + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable getGenerateStatusAsync(UUID operationId); + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable generateAsync(); + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/RecommendationsGenerateHeaders.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/RecommendationsGenerateHeaders.java new file mode 100644 index 0000000000000..622b25c83f0b1 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/RecommendationsGenerateHeaders.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Generate operation. + */ +public class RecommendationsGenerateHeaders { + /** + * The URL where the status of the asynchronous operation can be checked. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get the URL where the status of the asynchronous operation can be checked. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the URL where the status of the asynchronous operation can be checked. + * + * @param location the location value to set + * @return the RecommendationsGenerateHeaders object itself. + */ + public RecommendationsGenerateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the RecommendationsGenerateHeaders object itself. + */ + public RecommendationsGenerateHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ResourceRecommendationBase.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ResourceRecommendationBase.java new file mode 100644 index 0000000000000..ea9a754d25540 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ResourceRecommendationBase.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.ResourceRecommendationBaseInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.AdvisorManager; +import java.util.Map; +import org.joda.time.DateTime; +import java.util.List; +import java.util.UUID; + +/** + * Type representing ResourceRecommendationBase. + */ +public interface ResourceRecommendationBase extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the category value. + */ + Category category(); + + /** + * @return the extendedProperties value. + */ + Map extendedProperties(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the impact value. + */ + Impact impact(); + + /** + * @return the impactedField value. + */ + String impactedField(); + + /** + * @return the impactedValue value. + */ + String impactedValue(); + + /** + * @return the lastUpdated value. + */ + DateTime lastUpdated(); + + /** + * @return the metadata value. + */ + Map metadata(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the recommendationTypeId value. + */ + String recommendationTypeId(); + + /** + * @return the risk value. + */ + Risk risk(); + + /** + * @return the shortDescription value. + */ + ShortDescription shortDescription(); + + /** + * @return the suppressionIds value. + */ + List suppressionIds(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Risk.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Risk.java new file mode 100644 index 0000000000000..f4a1431c7d4eb --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Risk.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Risk. + */ +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 or finds a Risk from its string representation. + * @param name a name to look for + * @return the corresponding Risk + */ + @JsonCreator + public static Risk fromString(String name) { + return fromString(name, Risk.class); + } + + /** + * @return known Risk values + */ + public static Collection values() { + return values(Risk.class); + } +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ShortDescription.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ShortDescription.java new file mode 100644 index 0000000000000..e6c0e40bd6079 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/ShortDescription.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A summary of the recommendation. + */ +public class ShortDescription { + /** + * The issue or opportunity identified by the recommendation. + */ + @JsonProperty(value = "problem") + private String problem; + + /** + * The remediation action suggested by the recommendation. + */ + @JsonProperty(value = "solution") + private String solution; + + /** + * Get the issue or opportunity identified by the recommendation. + * + * @return the problem value + */ + public String problem() { + return this.problem; + } + + /** + * Set the issue or opportunity identified by the recommendation. + * + * @param problem the problem value to set + * @return the ShortDescription object itself. + */ + public ShortDescription withProblem(String problem) { + this.problem = problem; + return this; + } + + /** + * Get the remediation action suggested by the recommendation. + * + * @return the solution value + */ + public String solution() { + return this.solution; + } + + /** + * Set the remediation action suggested by the recommendation. + * + * @param solution the solution value to set + * @return the ShortDescription object itself. + */ + public ShortDescription withSolution(String solution) { + this.solution = solution; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/SuppressionContract.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/SuppressionContract.java new file mode 100644 index 0000000000000..a34efddbd2bf7 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/SuppressionContract.java @@ -0,0 +1,145 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.SuppressionContractInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.AdvisorManager; + +/** + * Type representing SuppressionContract. + */ +public interface SuppressionContract extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the suppressionId value. + */ + String suppressionId(); + + /** + * @return the ttl value. + */ + String ttl(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SuppressionContract definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithRecommendation, DefinitionStages.WithResourceUri, DefinitionStages.WithCreate { + } + + /** + * Grouping of SuppressionContract definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SuppressionContract definition. + */ + interface Blank extends WithRecommendation { + } + + /** + * The stage of the suppressioncontract definition allowing to specify Recommendation. + */ + interface WithRecommendation { + /** + * Specifies recommendationId. + */ + WithResourceUri withExistingRecommendation(String recommendationId); + } + + /** + * The stage of the suppressioncontract definition allowing to specify ResourceUri. + */ + interface WithResourceUri { + /** + * Specifies resourceUri. + */ + WithCreate withResourceUri(String resourceUri); + } + + /** + * The stage of the suppressioncontract definition allowing to specify SuppressionId. + */ + interface WithSuppressionId { + /** + * Specifies suppressionId. + */ + WithCreate withSuppressionId(String suppressionId); + } + + /** + * The stage of the suppressioncontract definition allowing to specify Ttl. + */ + interface WithTtl { + /** + * Specifies ttl. + */ + WithCreate withTtl(String ttl); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithSuppressionId, DefinitionStages.WithTtl { + } + } + /** + * The template for a SuppressionContract update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithSuppressionId, UpdateStages.WithTtl { + } + + /** + * Grouping of SuppressionContract update stages. + */ + interface UpdateStages { + /** + * The stage of the suppressioncontract update allowing to specify SuppressionId. + */ + interface WithSuppressionId { + /** + * Specifies suppressionId. + */ + Update withSuppressionId(String suppressionId); + } + + /** + * The stage of the suppressioncontract update allowing to specify Ttl. + */ + interface WithTtl { + /** + * Specifies ttl. + */ + Update withTtl(String ttl); + } + + } +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Suppressions.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Suppressions.java new file mode 100644 index 0000000000000..cd8492f3a6c5e --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/Suppressions.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.advisor.v2017_04_19.implementation.SuppressionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Suppressions. + */ +public interface Suppressions extends SupportsCreating, HasInner { + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceUri, String recommendationId, String name); + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceUri, String recommendationId, String name); + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ARMErrorResponseBodyImpl.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ARMErrorResponseBodyImpl.java new file mode 100644 index 0000000000000..10a058f8a6e23 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ARMErrorResponseBodyImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.management.advisor.v2017_04_19.ARMErrorResponseBody; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class ARMErrorResponseBodyImpl extends WrapperImpl implements ARMErrorResponseBody { + private final AdvisorManager manager; + ARMErrorResponseBodyImpl(ARMErrorResponseBodyInner inner, AdvisorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public AdvisorManager manager() { + return this.manager; + } + + @Override + public String code() { + return this.inner().code(); + } + + @Override + public String message() { + return this.inner().message(); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ARMErrorResponseBodyInner.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ARMErrorResponseBodyInner.java new file mode 100644 index 0000000000000..6ee54dbddca44 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ARMErrorResponseBodyInner.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * ARM error response body. + */ +public class ARMErrorResponseBodyInner { + /** + * Gets or sets the string that describes the error in detail and provides + * debugging information. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Gets or sets the string that can be used to programmatically identify + * the error. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Get gets or sets the string that describes the error in detail and provides debugging information. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set gets or sets the string that describes the error in detail and provides debugging information. + * + * @param message the message value to set + * @return the ARMErrorResponseBodyInner object itself. + */ + public ARMErrorResponseBodyInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get gets or sets the string that can be used to programmatically identify the error. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set gets or sets the string that can be used to programmatically identify the error. + * + * @param code the code value to set + * @return the ARMErrorResponseBodyInner object itself. + */ + public ARMErrorResponseBodyInner withCode(String code) { + this.code = code; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/AdvisorManagementClientImpl.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/AdvisorManagementClientImpl.java new file mode 100644 index 0000000000000..37a578b66d5a0 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/AdvisorManagementClientImpl.java @@ -0,0 +1,238 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the AdvisorManagementClientImpl class. + */ +public class AdvisorManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The Azure subscription ID. */ + private String subscriptionId; + + /** + * Gets The Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The version of the API to be used with the client request. */ + private String apiVersion; + + /** + * Gets The version of the API to be used with the client request. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public AdvisorManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The ConfigurationsInner object to access its operations. + */ + private ConfigurationsInner configurations; + + /** + * Gets the ConfigurationsInner object to access its operations. + * @return the ConfigurationsInner object. + */ + public ConfigurationsInner configurations() { + return this.configurations; + } + + /** + * The RecommendationsInner object to access its operations. + */ + private RecommendationsInner recommendations; + + /** + * Gets the RecommendationsInner object to access its operations. + * @return the RecommendationsInner object. + */ + public RecommendationsInner recommendations() { + return this.recommendations; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The SuppressionsInner object to access its operations. + */ + private SuppressionsInner suppressions; + + /** + * Gets the SuppressionsInner object to access its operations. + * @return the SuppressionsInner object. + */ + public SuppressionsInner suppressions() { + return this.suppressions; + } + + /** + * Initializes an instance of AdvisorManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public AdvisorManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of AdvisorManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public AdvisorManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of AdvisorManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public AdvisorManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-04-19"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.configurations = new ConfigurationsInner(restClient().retrofit(), this); + this.recommendations = new RecommendationsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.suppressions = new SuppressionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "AdvisorManagementClient", "2017-04-19"); + } +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/AdvisorManager.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/AdvisorManager.java new file mode 100644 index 0000000000000..5a7f797cf3216 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/AdvisorManager.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.advisor.v2017_04_19.Configurations; +import com.microsoft.azure.management.advisor.v2017_04_19.Recommendations; +import com.microsoft.azure.management.advisor.v2017_04_19.Operations; +import com.microsoft.azure.management.advisor.v2017_04_19.Suppressions; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Advisor resource management. + */ +public final class AdvisorManager extends ManagerCore { + private Configurations configurations; + private Recommendations recommendations; + private Operations operations; + private Suppressions suppressions; + /** + * Get a Configurable instance that can be used to create AdvisorManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new AdvisorManager.ConfigurableImpl(); + } + /** + * Creates an instance of AdvisorManager that exposes Advisor resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the AdvisorManager + */ + public static AdvisorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new AdvisorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of AdvisorManager that exposes Advisor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the AdvisorManager + */ + public static AdvisorManager authenticate(RestClient restClient, String subscriptionId) { + return new AdvisorManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of AdvisorManager that exposes Advisor management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Advisor management API entry points that work across subscriptions + */ + AdvisorManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Configurations. + */ + public Configurations configurations() { + if (this.configurations == null) { + this.configurations = new ConfigurationsImpl(this); + } + return this.configurations; + } + + /** + * @return Entry point to manage Recommendations. + */ + public Recommendations recommendations() { + if (this.recommendations == null) { + this.recommendations = new RecommendationsImpl(this); + } + return this.recommendations; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Suppressions. + */ + public Suppressions suppressions() { + if (this.suppressions == null) { + this.suppressions = new SuppressionsImpl(this); + } + return this.suppressions; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public AdvisorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return AdvisorManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private AdvisorManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new AdvisorManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigDataImpl.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigDataImpl.java new file mode 100644 index 0000000000000..d4c8f951aa36f --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigDataImpl.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.management.advisor.v2017_04_19.ConfigData; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.advisor.v2017_04_19.ConfigDataProperties; + +class ConfigDataImpl extends WrapperImpl implements ConfigData { + private final AdvisorManager manager; + + ConfigDataImpl(ConfigDataInner inner, AdvisorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public AdvisorManager manager() { + return this.manager; + } + + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ConfigDataProperties properties() { + return this.inner().properties(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigDataInner.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigDataInner.java new file mode 100644 index 0000000000000..62a3fb0ebf744 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigDataInner.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.management.advisor.v2017_04_19.ConfigDataProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Advisor configuration data structure. + */ +public class ConfigDataInner { + /** + * The resource Id of the configuration resource. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The type of the configuration resource. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The name of the configuration resource. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The list of property name/value pairs. + */ + @JsonProperty(value = "properties") + private ConfigDataProperties properties; + + /** + * Get the resource Id of the configuration resource. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the resource Id of the configuration resource. + * + * @param id the id value to set + * @return the ConfigDataInner object itself. + */ + public ConfigDataInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type of the configuration resource. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type of the configuration resource. + * + * @param type the type value to set + * @return the ConfigDataInner object itself. + */ + public ConfigDataInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name of the configuration resource. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the configuration resource. + * + * @param name the name value to set + * @return the ConfigDataInner object itself. + */ + public ConfigDataInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the list of property name/value pairs. + * + * @return the properties value + */ + public ConfigDataProperties properties() { + return this.properties; + } + + /** + * Set the list of property name/value pairs. + * + * @param properties the properties value to set + * @return the ConfigDataInner object itself. + */ + public ConfigDataInner withProperties(ConfigDataProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigurationsImpl.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigurationsImpl.java new file mode 100644 index 0000000000000..4ad34e8e20633 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigurationsImpl.java @@ -0,0 +1,117 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2017_04_19.Configurations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.advisor.v2017_04_19.ARMErrorResponseBody; +import com.microsoft.azure.arm.utils.PagedListConverter; +import com.microsoft.azure.management.advisor.v2017_04_19.ConfigData; + +class ConfigurationsImpl extends WrapperImpl implements Configurations { + private PagedListConverter converter; + private final AdvisorManager manager; + + ConfigurationsImpl(AdvisorManager manager) { + super(manager.inner().configurations()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(ConfigDataInner inner) { + return Observable.just((ConfigData) wrapModel(inner)); + } + }; + } + + public AdvisorManager manager() { + return this.manager; + } + + private ConfigDataImpl wrapModel(ConfigDataInner inner) { + return new ConfigDataImpl(inner, manager()); + } + + @Override + public Observable createInSubscriptionAsync(ConfigDataInner configContract) { + ConfigurationsInner client = this.inner(); + return client.createInSubscriptionAsync(configContract) + .map(new Func1() { + @Override + public ARMErrorResponseBody call(ARMErrorResponseBodyInner inner) { + return new ARMErrorResponseBodyImpl(inner, manager()); + } + }); + } + + @Override + public Observable createInResourceGroupAsync(String resourceGroup, ConfigDataInner configContract) { + ConfigurationsInner client = this.inner(); + return client.createInResourceGroupAsync(resourceGroup, configContract) + .map(new Func1() { + @Override + public ARMErrorResponseBody call(ARMErrorResponseBodyInner inner) { + return new ARMErrorResponseBodyImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + ConfigurationsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + ConfigurationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ConfigData call(ConfigDataInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ConfigurationsInner client = this.inner(); + return converter.convert(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ConfigurationsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public ConfigData call(ConfigDataInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigurationsInner.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigurationsInner.java new file mode 100644 index 0000000000000..fcc777b75bcbe --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ConfigurationsInner.java @@ -0,0 +1,575 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Configurations. + */ +public class ConfigurationsInner implements InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ConfigurationsService service; + /** The service client containing this operation class. */ + private AdvisorManagementClientImpl client; + + /** + * Initializes an instance of ConfigurationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ConfigurationsInner(Retrofit retrofit, AdvisorManagementClientImpl client) { + this.service = retrofit.create(ConfigurationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Configurations to be + * used by Retrofit to perform actually REST calls. + */ + interface ConfigurationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Configurations list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Configurations createInSubscription" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/configurations") + Observable> createInSubscription(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body ConfigDataInner configContract, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Configurations listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Configurations createInResourceGroup" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Advisor/configurations") + Observable> createInResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroup") String resourceGroup, @Query("api-version") String apiVersion, @Body ConfigDataInner configContract, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Configurations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieve Azure Advisor configurations. + * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ConfigDataInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve Azure Advisor configurations. + * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve Azure Advisor configurations. + * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigDataInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve Azure Advisor configurations. + * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigDataInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve Azure Advisor configurations. + * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConfigDataInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create/Overwrite Azure Advisor configuration. + * Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + * + * @param configContract The Azure Advisor configuration data structure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ARMErrorResponseBodyInner object if successful. + */ + public ARMErrorResponseBodyInner createInSubscription(ConfigDataInner configContract) { + return createInSubscriptionWithServiceResponseAsync(configContract).toBlocking().single().body(); + } + + /** + * Create/Overwrite Azure Advisor configuration. + * Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + * + * @param configContract The Azure Advisor configuration data structure. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createInSubscriptionAsync(ConfigDataInner configContract, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createInSubscriptionWithServiceResponseAsync(configContract), serviceCallback); + } + + /** + * Create/Overwrite Azure Advisor configuration. + * Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + * + * @param configContract The Azure Advisor configuration data structure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ARMErrorResponseBodyInner object + */ + public Observable createInSubscriptionAsync(ConfigDataInner configContract) { + return createInSubscriptionWithServiceResponseAsync(configContract).map(new Func1, ARMErrorResponseBodyInner>() { + @Override + public ARMErrorResponseBodyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create/Overwrite Azure Advisor configuration. + * Create/Overwrite Azure Advisor configuration and also delete all configurations of contained resource groups. + * + * @param configContract The Azure Advisor configuration data structure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ARMErrorResponseBodyInner object + */ + public Observable> createInSubscriptionWithServiceResponseAsync(ConfigDataInner configContract) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (configContract == null) { + throw new IllegalArgumentException("Parameter configContract is required and cannot be null."); + } + Validator.validate(configContract); + return service.createInSubscription(this.client.subscriptionId(), this.client.apiVersion(), configContract, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createInSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createInSubscriptionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(400, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve Azure Advisor configurations. + * + * @param resourceGroup The name of the Azure resource group. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroup) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroup).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Retrieve Azure Advisor configurations. + * + * @param resourceGroup The name of the Azure resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroup, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroup), serviceCallback); + } + + /** + * Retrieve Azure Advisor configurations. + * + * @param resourceGroup The name of the Azure resource group. + * @return the observable to the List<ConfigDataInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroup) { + return listByResourceGroupWithServiceResponseAsync(resourceGroup).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Retrieve Azure Advisor configurations. + * + * @param resourceGroup The name of the Azure resource group. + * @return the observable to the List<ConfigDataInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroup) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroup, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create/Overwrite Azure Advisor configuration. + * + * @param resourceGroup The name of the Azure resource group. + * @param configContract The Azure Advisor configuration data structure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ARMErrorResponseBodyInner object if successful. + */ + public ARMErrorResponseBodyInner createInResourceGroup(String resourceGroup, ConfigDataInner configContract) { + return createInResourceGroupWithServiceResponseAsync(resourceGroup, configContract).toBlocking().single().body(); + } + + /** + * Create/Overwrite Azure Advisor configuration. + * + * @param resourceGroup The name of the Azure resource group. + * @param configContract The Azure Advisor configuration data structure. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createInResourceGroupAsync(String resourceGroup, ConfigDataInner configContract, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createInResourceGroupWithServiceResponseAsync(resourceGroup, configContract), serviceCallback); + } + + /** + * Create/Overwrite Azure Advisor configuration. + * + * @param resourceGroup The name of the Azure resource group. + * @param configContract The Azure Advisor configuration data structure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ARMErrorResponseBodyInner object + */ + public Observable createInResourceGroupAsync(String resourceGroup, ConfigDataInner configContract) { + return createInResourceGroupWithServiceResponseAsync(resourceGroup, configContract).map(new Func1, ARMErrorResponseBodyInner>() { + @Override + public ARMErrorResponseBodyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create/Overwrite Azure Advisor configuration. + * + * @param resourceGroup The name of the Azure resource group. + * @param configContract The Azure Advisor configuration data structure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ARMErrorResponseBodyInner object + */ + public Observable> createInResourceGroupWithServiceResponseAsync(String resourceGroup, ConfigDataInner configContract) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroup == null) { + throw new IllegalArgumentException("Parameter resourceGroup is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (configContract == null) { + throw new IllegalArgumentException("Parameter configContract is required and cannot be null."); + } + Validator.validate(configContract); + return service.createInResourceGroup(this.client.subscriptionId(), resourceGroup, this.client.apiVersion(), configContract, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createInResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createInResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .register(400, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieve Azure Advisor configurations. + * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ConfigDataInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieve Azure Advisor configurations. + * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieve Azure Advisor configurations. + * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigDataInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieve Azure Advisor configurations. + * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ConfigDataInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieve Azure Advisor configurations. + * Retrieve Azure Advisor configurations and also retrieve configurations of contained resource groups. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ConfigDataInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/IdParsingUtils.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..7e4efef9e1220 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationEntityImpl.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationEntityImpl.java new file mode 100644 index 0000000000000..4d324045d0721 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationEntityImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.management.advisor.v2017_04_19.OperationEntity; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2017_04_19.OperationDisplayInfo; + +class OperationEntityImpl extends WrapperImpl implements OperationEntity { + private final AdvisorManager manager; + OperationEntityImpl(OperationEntityInner inner, AdvisorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public AdvisorManager manager() { + return this.manager; + } + + @Override + public OperationDisplayInfo display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationEntityInner.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationEntityInner.java new file mode 100644 index 0000000000000..44c41c940d9e7 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationEntityInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.management.advisor.v2017_04_19.OperationDisplayInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The operation supported by Advisor. + */ +public class OperationEntityInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The operation supported by Advisor. + */ + @JsonProperty(value = "display") + private OperationDisplayInfo display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationEntityInner object itself. + */ + public OperationEntityInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the operation supported by Advisor. + * + * @return the display value + */ + public OperationDisplayInfo display() { + return this.display; + } + + /** + * Set the operation supported by Advisor. + * + * @param display the display value to set + * @return the OperationEntityInner object itself. + */ + public OperationEntityInner withDisplay(OperationDisplayInfo display) { + this.display = display; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationsImpl.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..0cd0e859ca322 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2017_04_19.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.advisor.v2017_04_19.OperationEntity; + +class OperationsImpl extends WrapperImpl implements Operations { + private final AdvisorManager manager; + + OperationsImpl(AdvisorManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public AdvisorManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public OperationEntity call(OperationEntityInner inner) { + return new OperationEntityImpl(inner, manager()); + } + }); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationsInner.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationsInner.java new file mode 100644 index 0000000000000..c1116d5b6215d --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private AdvisorManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, AdvisorManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Operations list" }) + @GET("providers/Microsoft.Advisor/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationEntityInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationEntityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationEntityInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationEntityInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all the available Advisor REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationEntityInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/PageImpl.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/PageImpl.java new file mode 100644 index 0000000000000..49b0de32c29ad --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/PageImpl1.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/PageImpl1.java new file mode 100644 index 0000000000000..13195b841a336 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/RecommendationsImpl.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/RecommendationsImpl.java new file mode 100644 index 0000000000000..2c6e5f98213e6 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/RecommendationsImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2017_04_19.Recommendations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.advisor.v2017_04_19.ResourceRecommendationBase; +import com.microsoft.azure.arm.utils.PagedListConverter; +import rx.Completable; +import java.util.UUID; + +class RecommendationsImpl extends WrapperImpl implements Recommendations { + private PagedListConverter converter; + private final AdvisorManager manager; + + RecommendationsImpl(AdvisorManager manager) { + super(manager.inner().recommendations()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(ResourceRecommendationBaseInner inner) { + return Observable.just((ResourceRecommendationBase) wrapModel(inner)); + } + }; + } + + public AdvisorManager manager() { + return this.manager; + } + + private ResourceRecommendationBaseImpl wrapModel(ResourceRecommendationBaseInner inner) { + return new ResourceRecommendationBaseImpl(inner, manager()); + } + + @Override + public Observable getAsync(String resourceUri, String recommendationId) { + RecommendationsInner client = this.inner(); + return client.getAsync(resourceUri, recommendationId) + .map(new Func1() { + @Override + public ResourceRecommendationBase call(ResourceRecommendationBaseInner inner) { + return new ResourceRecommendationBaseImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + RecommendationsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + RecommendationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ResourceRecommendationBase call(ResourceRecommendationBaseInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable getGenerateStatusAsync(UUID operationId) { + RecommendationsInner client = this.inner(); + return client.getGenerateStatusAsync(operationId).toCompletable(); + } + + @Override + public Completable generateAsync() { + RecommendationsInner client = this.inner(); + return client.generateAsync().toCompletable(); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/RecommendationsInner.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/RecommendationsInner.java new file mode 100644 index 0000000000000..469b3c7764620 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/RecommendationsInner.java @@ -0,0 +1,655 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.advisor.v2017_04_19.RecommendationsGenerateHeaders; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import java.util.List; +import java.util.UUID; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Recommendations. + */ +public class RecommendationsInner { + /** The Retrofit service to perform REST calls. */ + private RecommendationsService service; + /** The service client containing this operation class. */ + private AdvisorManagementClientImpl client; + + /** + * Initializes an instance of RecommendationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecommendationsInner(Retrofit retrofit, AdvisorManagementClientImpl client) { + this.service = retrofit.create(RecommendationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Recommendations to be + * used by Retrofit to perform actually REST calls. + */ + interface RecommendationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Recommendations generate" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations") + Observable> generate(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Recommendations getGenerateStatus" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/generateRecommendations/{operationId}") + Observable> getGenerateStatus(@Path("subscriptionId") String subscriptionId, @Path("operationId") UUID operationId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Recommendations list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/recommendations") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skipToken") String skipToken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Recommendations get" }) + @GET("{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}") + Observable> get(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Recommendations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void generate() { + generateWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture generateAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(generateWithServiceResponseAsync(), serviceCallback); + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable generateAsync() { + return generateWithServiceResponseAsync().map(new Func1, Void>() { + @Override + public Void call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Initiates the recommendation generation or computation process for a subscription. This operation is asynchronous. The generated recommendations are stored in a cache in the Advisor service. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponseWithHeaders} object if successful. + */ + public Observable> generateWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.generate(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = generateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders generateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, RecommendationsGenerateHeaders.class); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void getGenerateStatus(UUID operationId) { + getGenerateStatusWithServiceResponseAsync(operationId).toBlocking().single().body(); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getGenerateStatusAsync(UUID operationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getGenerateStatusWithServiceResponseAsync(operationId), serviceCallback); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable getGenerateStatusAsync(UUID operationId) { + return getGenerateStatusWithServiceResponseAsync(operationId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves the status of the recommendation computation or generation process. Invoke this API after calling the generation recommendation. The URI of this API is returned in the Location field of the response header. + * + * @param operationId The operation ID, which can be found from the Location field in the generate recommendation response header. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> getGenerateStatusWithServiceResponseAsync(UUID operationId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (operationId == null) { + throw new IllegalArgumentException("Parameter operationId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getGenerateStatus(this.client.subscriptionId(), operationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getGenerateStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getGenerateStatusDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceRecommendationBaseInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceRecommendationBaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String skipToken = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), filter, top, skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceRecommendationBaseInner> object if successful. + */ + public PagedList list(final String filter, final Integer top, final String skipToken) { + ServiceResponse> response = listSinglePageAsync(filter, top, skipToken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String filter, final Integer top, final String skipToken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, top, skipToken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable> listAsync(final String filter, final Integer top, final String skipToken) { + return listWithServiceResponseAsync(filter, top, skipToken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param filter The filter to apply to the recommendations. + * @param top The number of recommendations per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final Integer top, final String skipToken) { + return listSinglePageAsync(filter, top, skipToken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + ServiceResponse> * @param filter The filter to apply to the recommendations. + ServiceResponse> * @param top The number of recommendations per page if a paged version of this API is being used. + ServiceResponse> * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceRecommendationBaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final Integer top, final String skipToken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), filter, top, skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ResourceRecommendationBaseInner object if successful. + */ + public ResourceRecommendationBaseInner get(String resourceUri, String recommendationId) { + return getWithServiceResponseAsync(resourceUri, recommendationId).toBlocking().single().body(); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String recommendationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, recommendationId), serviceCallback); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceRecommendationBaseInner object + */ + public Observable getAsync(String resourceUri, String recommendationId) { + return getWithServiceResponseAsync(resourceUri, recommendationId).map(new Func1, ResourceRecommendationBaseInner>() { + @Override + public ResourceRecommendationBaseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Obtains details of a cached recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ResourceRecommendationBaseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String recommendationId) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceUri, recommendationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ResourceRecommendationBaseInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ResourceRecommendationBaseInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Obtains cached recommendations for a subscription. The recommendations are generated or computed by invoking generateRecommendations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ResourceRecommendationBaseInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ResourceRecommendationBaseImpl.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ResourceRecommendationBaseImpl.java new file mode 100644 index 0000000000000..8e5a7587ddb69 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ResourceRecommendationBaseImpl.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.management.advisor.v2017_04_19.ResourceRecommendationBase; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.advisor.v2017_04_19.Category; +import java.util.Map; +import com.microsoft.azure.management.advisor.v2017_04_19.Impact; +import org.joda.time.DateTime; +import com.microsoft.azure.management.advisor.v2017_04_19.Risk; +import com.microsoft.azure.management.advisor.v2017_04_19.ShortDescription; +import java.util.List; +import java.util.UUID; + +class ResourceRecommendationBaseImpl extends IndexableRefreshableWrapperImpl implements ResourceRecommendationBase { + private String resourceUri; + private String recommendationId; + private final AdvisorManager manager; + + ResourceRecommendationBaseImpl(ResourceRecommendationBaseInner inner, AdvisorManager manager) { + super(null, inner); + this.manager = manager; + this.recommendationId = IdParsingUtils.getValueFromIdByName(inner.id(), "recommendations"); + this.resourceUri = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + } + + @Override + public AdvisorManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + RecommendationsInner client = this.manager().inner().recommendations(); + return client.getAsync(this.resourceUri, this.recommendationId); + } + + + + @Override + public Category category() { + return this.inner().category(); + } + + @Override + public Map extendedProperties() { + return this.inner().extendedProperties(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Impact impact() { + return this.inner().impact(); + } + + @Override + public String impactedField() { + return this.inner().impactedField(); + } + + @Override + public String impactedValue() { + return this.inner().impactedValue(); + } + + @Override + public DateTime lastUpdated() { + return this.inner().lastUpdated(); + } + + @Override + public Map metadata() { + return this.inner().metadata(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String recommendationTypeId() { + return this.inner().recommendationTypeId(); + } + + @Override + public Risk risk() { + return this.inner().risk(); + } + + @Override + public ShortDescription shortDescription() { + return this.inner().shortDescription(); + } + + @Override + public List suppressionIds() { + return this.inner().suppressionIds(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ResourceRecommendationBaseInner.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ResourceRecommendationBaseInner.java new file mode 100644 index 0000000000000..a54a041045140 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/ResourceRecommendationBaseInner.java @@ -0,0 +1,318 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.management.advisor.v2017_04_19.Category; +import com.microsoft.azure.management.advisor.v2017_04_19.Impact; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.advisor.v2017_04_19.Risk; +import com.microsoft.azure.management.advisor.v2017_04_19.ShortDescription; +import java.util.List; +import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Advisor Recommendation. + */ +@JsonFlatten +public class ResourceRecommendationBaseInner extends ProxyResource { + /** + * The category of the recommendation. Possible values include: + * 'HighAvailability', 'Security', 'Performance', 'Cost'. + */ + @JsonProperty(value = "properties.category") + private Category category; + + /** + * The business impact of the recommendation. Possible values include: + * 'High', 'Medium', 'Low'. + */ + @JsonProperty(value = "properties.impact") + private Impact impact; + + /** + * The resource type identified by Advisor. + */ + @JsonProperty(value = "properties.impactedField") + private String impactedField; + + /** + * The resource identified by Advisor. + */ + @JsonProperty(value = "properties.impactedValue") + private String impactedValue; + + /** + * The most recent time that Advisor checked the validity of the + * recommendation. + */ + @JsonProperty(value = "properties.lastUpdated") + private DateTime lastUpdated; + + /** + * The recommendation metadata. + */ + @JsonProperty(value = "properties.metadata") + private Map metadata; + + /** + * The recommendation-type GUID. + */ + @JsonProperty(value = "properties.recommendationTypeId") + private String recommendationTypeId; + + /** + * The potential risk of not implementing the recommendation. Possible + * values include: 'Error', 'Warning', 'None'. + */ + @JsonProperty(value = "properties.risk") + private Risk risk; + + /** + * A summary of the recommendation. + */ + @JsonProperty(value = "properties.shortDescription") + private ShortDescription shortDescription; + + /** + * The list of snoozed and dismissed rules for the recommendation. + */ + @JsonProperty(value = "properties.suppressionIds") + private List suppressionIds; + + /** + * Extended properties. + */ + @JsonProperty(value = "properties.extendedProperties") + private Map extendedProperties; + + /** + * Get the category of the recommendation. Possible values include: 'HighAvailability', 'Security', 'Performance', 'Cost'. + * + * @return the category value + */ + public Category category() { + return this.category; + } + + /** + * Set the category of the recommendation. Possible values include: 'HighAvailability', 'Security', 'Performance', 'Cost'. + * + * @param category the category value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withCategory(Category category) { + this.category = category; + return this; + } + + /** + * Get the business impact of the recommendation. Possible values include: 'High', 'Medium', 'Low'. + * + * @return the impact value + */ + public Impact impact() { + return this.impact; + } + + /** + * Set the business impact of the recommendation. Possible values include: 'High', 'Medium', 'Low'. + * + * @param impact the impact value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withImpact(Impact impact) { + this.impact = impact; + return this; + } + + /** + * Get the resource type identified by Advisor. + * + * @return the impactedField value + */ + public String impactedField() { + return this.impactedField; + } + + /** + * Set the resource type identified by Advisor. + * + * @param impactedField the impactedField value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withImpactedField(String impactedField) { + this.impactedField = impactedField; + return this; + } + + /** + * Get the resource identified by Advisor. + * + * @return the impactedValue value + */ + public String impactedValue() { + return this.impactedValue; + } + + /** + * Set the resource identified by Advisor. + * + * @param impactedValue the impactedValue value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withImpactedValue(String impactedValue) { + this.impactedValue = impactedValue; + return this; + } + + /** + * Get the most recent time that Advisor checked the validity of the recommendation. + * + * @return the lastUpdated value + */ + public DateTime lastUpdated() { + return this.lastUpdated; + } + + /** + * Set the most recent time that Advisor checked the validity of the recommendation. + * + * @param lastUpdated the lastUpdated value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withLastUpdated(DateTime lastUpdated) { + this.lastUpdated = lastUpdated; + return this; + } + + /** + * Get the recommendation metadata. + * + * @return the metadata value + */ + public Map metadata() { + return this.metadata; + } + + /** + * Set the recommendation metadata. + * + * @param metadata the metadata value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the recommendation-type GUID. + * + * @return the recommendationTypeId value + */ + public String recommendationTypeId() { + return this.recommendationTypeId; + } + + /** + * Set the recommendation-type GUID. + * + * @param recommendationTypeId the recommendationTypeId value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withRecommendationTypeId(String recommendationTypeId) { + this.recommendationTypeId = recommendationTypeId; + return this; + } + + /** + * Get the potential risk of not implementing the recommendation. Possible values include: 'Error', 'Warning', 'None'. + * + * @return the risk value + */ + public Risk risk() { + return this.risk; + } + + /** + * Set the potential risk of not implementing the recommendation. Possible values include: 'Error', 'Warning', 'None'. + * + * @param risk the risk value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withRisk(Risk risk) { + this.risk = risk; + return this; + } + + /** + * Get a summary of the recommendation. + * + * @return the shortDescription value + */ + public ShortDescription shortDescription() { + return this.shortDescription; + } + + /** + * Set a summary of the recommendation. + * + * @param shortDescription the shortDescription value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withShortDescription(ShortDescription shortDescription) { + this.shortDescription = shortDescription; + return this; + } + + /** + * Get the list of snoozed and dismissed rules for the recommendation. + * + * @return the suppressionIds value + */ + public List suppressionIds() { + return this.suppressionIds; + } + + /** + * Set the list of snoozed and dismissed rules for the recommendation. + * + * @param suppressionIds the suppressionIds value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withSuppressionIds(List suppressionIds) { + this.suppressionIds = suppressionIds; + return this; + } + + /** + * Get extended properties. + * + * @return the extendedProperties value + */ + public Map extendedProperties() { + return this.extendedProperties; + } + + /** + * Set extended properties. + * + * @param extendedProperties the extendedProperties value to set + * @return the ResourceRecommendationBaseInner object itself. + */ + public ResourceRecommendationBaseInner withExtendedProperties(Map extendedProperties) { + this.extendedProperties = extendedProperties; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionContractImpl.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionContractImpl.java new file mode 100644 index 0000000000000..972921a5cca74 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionContractImpl.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.management.advisor.v2017_04_19.SuppressionContract; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class SuppressionContractImpl extends CreatableUpdatableImpl implements SuppressionContract, SuppressionContract.Definition, SuppressionContract.Update { + private final AdvisorManager manager; + private String resourceUri; + private String recommendationId; + private String name; + + SuppressionContractImpl(String name, AdvisorManager manager) { + super(name, new SuppressionContractInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + SuppressionContractImpl(SuppressionContractInner inner, AdvisorManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.name = inner.name(); + // resource ancestor names + this.recommendationId = IdParsingUtils.getValueFromIdByName(inner.id(), "recommendations"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "suppressions"); + this.resourceUri = IdParsingUtils.getValueFromIdByPosition(inner.id(), 0); + // + } + + @Override + public AdvisorManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SuppressionsInner client = this.manager().inner().suppressions(); + return client.createAsync(this.resourceUri, this.recommendationId, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SuppressionsInner client = this.manager().inner().suppressions(); + return client.createAsync(this.resourceUri, this.recommendationId, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SuppressionsInner client = this.manager().inner().suppressions(); + return client.getAsync(this.resourceUri, this.recommendationId, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String suppressionId() { + return this.inner().suppressionId(); + } + + @Override + public String ttl() { + return this.inner().ttl(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SuppressionContractImpl withExistingRecommendation(String recommendationId) { + this.recommendationId = recommendationId; + return this; + } + + @Override + public SuppressionContractImpl withResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + @Override + public SuppressionContractImpl withSuppressionId(String suppressionId) { + this.inner().withSuppressionId(suppressionId); + return this; + } + + @Override + public SuppressionContractImpl withTtl(String ttl) { + this.inner().withTtl(ttl); + return this; + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionContractInner.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionContractInner.java new file mode 100644 index 0000000000000..0b08aaf02a98c --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionContractInner.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The details of the snoozed or dismissed rule; for example, the duration, + * name, and GUID associated with the rule. + */ +@JsonFlatten +public class SuppressionContractInner extends ProxyResource { + /** + * The GUID of the suppression. + */ + @JsonProperty(value = "properties.suppressionId") + private String suppressionId; + + /** + * The duration for which the suppression is valid. + */ + @JsonProperty(value = "properties.ttl") + private String ttl; + + /** + * Get the GUID of the suppression. + * + * @return the suppressionId value + */ + public String suppressionId() { + return this.suppressionId; + } + + /** + * Set the GUID of the suppression. + * + * @param suppressionId the suppressionId value to set + * @return the SuppressionContractInner object itself. + */ + public SuppressionContractInner withSuppressionId(String suppressionId) { + this.suppressionId = suppressionId; + return this; + } + + /** + * Get the duration for which the suppression is valid. + * + * @return the ttl value + */ + public String ttl() { + return this.ttl; + } + + /** + * Set the duration for which the suppression is valid. + * + * @param ttl the ttl value to set + * @return the SuppressionContractInner object itself. + */ + public SuppressionContractInner withTtl(String ttl) { + this.ttl = ttl; + return this; + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionsImpl.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionsImpl.java new file mode 100644 index 0000000000000..c071181c6ea67 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionsImpl.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.advisor.v2017_04_19.Suppressions; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.advisor.v2017_04_19.SuppressionContract; + +class SuppressionsImpl extends WrapperImpl implements Suppressions { + private final AdvisorManager manager; + + SuppressionsImpl(AdvisorManager manager) { + super(manager.inner().suppressions()); + this.manager = manager; + } + + public AdvisorManager manager() { + return this.manager; + } + + @Override + public SuppressionContractImpl define(String name) { + return wrapModel(name); + } + + private SuppressionContractImpl wrapModel(SuppressionContractInner inner) { + return new SuppressionContractImpl(inner, manager()); + } + + private SuppressionContractImpl wrapModel(String name) { + return new SuppressionContractImpl(name, this.manager()); + } + + @Override + public Observable listAsync() { + SuppressionsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SuppressionContract call(SuppressionContractInner inner) { + return new SuppressionContractImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceUri, String recommendationId, String name) { + SuppressionsInner client = this.inner(); + return client.getAsync(resourceUri, recommendationId, name) + .map(new Func1() { + @Override + public SuppressionContract call(SuppressionContractInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceUri, String recommendationId, String name) { + SuppressionsInner client = this.inner(); + return client.deleteAsync(resourceUri, recommendationId, name).toCompletable(); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionsInner.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionsInner.java new file mode 100644 index 0000000000000..6c070085f7261 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/SuppressionsInner.java @@ -0,0 +1,693 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Suppressions. + */ +public class SuppressionsInner { + /** The Retrofit service to perform REST calls. */ + private SuppressionsService service; + /** The service client containing this operation class. */ + private AdvisorManagementClientImpl client; + + /** + * Initializes an instance of SuppressionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SuppressionsInner(Retrofit retrofit, AdvisorManagementClientImpl client) { + this.service = retrofit.create(SuppressionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Suppressions to be + * used by Retrofit to perform actually REST calls. + */ + interface SuppressionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Suppressions get" }) + @GET("{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") + Observable> get(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Suppressions create" }) + @PUT("{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}") + Observable> create(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Path("name") String name, @Body SuppressionContractInner suppressionContract, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Suppressions delete" }) + @HTTP(path = "{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceUri") String resourceUri, @Path("recommendationId") String recommendationId, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Suppressions list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Advisor/suppressions") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$top") Integer top, @Query("$skipToken") String skipToken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.advisor.v2017_04_19.Suppressions listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SuppressionContractInner object if successful. + */ + public SuppressionContractInner get(String resourceUri, String recommendationId, String name) { + return getWithServiceResponseAsync(resourceUri, recommendationId, name).toBlocking().single().body(); + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceUri, String recommendationId, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceUri, recommendationId, name), serviceCallback); + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable getAsync(String resourceUri, String recommendationId, String name) { + return getWithServiceResponseAsync(resourceUri, recommendationId, name).map(new Func1, SuppressionContractInner>() { + @Override + public SuppressionContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Obtains the details of a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable> getWithServiceResponseAsync(String resourceUri, String recommendationId, String name) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceUri, recommendationId, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SuppressionContractInner object if successful. + */ + public SuppressionContractInner create(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract) { + return createWithServiceResponseAsync(resourceUri, recommendationId, name, suppressionContract).toBlocking().single().body(); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createWithServiceResponseAsync(resourceUri, recommendationId, name, suppressionContract), serviceCallback); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable createAsync(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract) { + return createWithServiceResponseAsync(resourceUri, recommendationId, name, suppressionContract).map(new Func1, SuppressionContractInner>() { + @Override + public SuppressionContractInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enables the snoozed or dismissed attribute of a recommendation. The snoozed or dismissed attribute is referred to as a suppression. Use this API to create or update the snoozed or dismissed status of a recommendation. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param suppressionContract The snoozed or dismissed attribute; for example, the snooze duration. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SuppressionContractInner object + */ + public Observable> createWithServiceResponseAsync(String resourceUri, String recommendationId, String name, SuppressionContractInner suppressionContract) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (suppressionContract == null) { + throw new IllegalArgumentException("Parameter suppressionContract is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(suppressionContract); + return service.create(resourceUri, recommendationId, name, suppressionContract, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceUri, String recommendationId, String name) { + deleteWithServiceResponseAsync(resourceUri, recommendationId, name).toBlocking().single().body(); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceUri, String recommendationId, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceUri, recommendationId, name), serviceCallback); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceUri, String recommendationId, String name) { + return deleteWithServiceResponseAsync(resourceUri, recommendationId, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enables the activation of a snoozed or dismissed recommendation. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param resourceUri The fully qualified Azure Resource Manager identifier of the resource to which the recommendation applies. + * @param recommendationId The recommendation ID. + * @param name The name of the suppression. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceUri, String recommendationId, String name) { + if (resourceUri == null) { + throw new IllegalArgumentException("Parameter resourceUri is required and cannot be null."); + } + if (recommendationId == null) { + throw new IllegalArgumentException("Parameter recommendationId is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceUri, recommendationId, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SuppressionContractInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SuppressionContractInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SuppressionContractInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SuppressionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer top = null; + final String skipToken = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), top, skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param top The number of suppressions per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SuppressionContractInner> object if successful. + */ + public PagedList list(final Integer top, final String skipToken) { + ServiceResponse> response = listSinglePageAsync(top, skipToken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param top The number of suppressions per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final Integer top, final String skipToken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(top, skipToken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param top The number of suppressions per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SuppressionContractInner> object + */ + public Observable> listAsync(final Integer top, final String skipToken) { + return listWithServiceResponseAsync(top, skipToken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param top The number of suppressions per page if a paged version of this API is being used. + * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SuppressionContractInner> object + */ + public Observable>> listWithServiceResponseAsync(final Integer top, final String skipToken) { + return listSinglePageAsync(top, skipToken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + ServiceResponse> * @param top The number of suppressions per page if a paged version of this API is being used. + ServiceResponse> * @param skipToken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SuppressionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final Integer top, final String skipToken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), top, skipToken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SuppressionContractInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SuppressionContractInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SuppressionContractInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Retrieves the list of snoozed or dismissed suppressions for a subscription. The snoozed or dismissed attribute of a recommendation is referred to as a suppression. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SuppressionContractInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/package-info.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/package-info.java new file mode 100644 index 0000000000000..85dd5aff554f0 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for AdvisorManagementClient. + * REST APIs for Azure Advisor. + */ +package com.microsoft.azure.management.advisor.v2017_04_19.implementation; diff --git a/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/package-info.java b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/package-info.java new file mode 100644 index 0000000000000..f014ad871cae3 --- /dev/null +++ b/advisor/resource-manager/v2017_04_19/src/main/java/com/microsoft/azure/management/advisor/v2017_04_19/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for AdvisorManagementClient. + * REST APIs for Azure Advisor. + */ +package com.microsoft.azure.management.advisor.v2017_04_19;