From 62a1a3e040e8a8dbaca9047d8488dd15b632bb73 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 26 Nov 2020 03:58:33 +0000 Subject: [PATCH] CodeGen from PR 11728 in Azure/azure-rest-api-specs python track2 (#11728) --- sdk/consumption/mgmt-v2018_06_30/pom.xml | 135 + .../v2018_06_30/AggregatedCosts.java | 36 + .../consumption/v2018_06_30/Balance.java | 118 + ...alancePropertiesAdjustmentDetailsItem.java | 48 + ...ancePropertiesNewPurchasesDetailsItem.java | 48 + .../consumption/v2018_06_30/Balances.java | 36 + .../v2018_06_30/BillingFrequency.java | 44 + .../consumption/v2018_06_30/Bound.java | 41 + .../consumption/v2018_06_30/Budget.java | 249 ++ .../v2018_06_30/BudgetTimePeriod.java | 71 + .../consumption/v2018_06_30/Budgets.java | 55 + .../consumption/v2018_06_30/CategoryType.java | 41 + .../consumption/v2018_06_30/ChargeType.java | 41 + .../consumption/v2018_06_30/CostTag.java | 46 + .../v2018_06_30/CostTagProperties.java | 43 + .../consumption/v2018_06_30/CostTags.java | 37 + .../consumption/v2018_06_30/CurrentSpend.java | 48 + .../consumption/v2018_06_30/Datagrain.java | 41 + .../consumption/v2018_06_30/ErrorDetails.java | 47 + .../v2018_06_30/ErrorResponse.java | 44 + .../v2018_06_30/ErrorResponseException.java | 44 + .../consumption/v2018_06_30/Filters.java | 126 + .../consumption/v2018_06_30/Forecast.java | 73 + ...orecastPropertiesConfidenceLevelsItem.java | 75 + .../consumption/v2018_06_30/Forecasts.java | 19 + .../consumption/v2018_06_30/Grain.java | 44 + .../ManagementGroupAggregatedCostResult.java | 73 + .../consumption/v2018_06_30/Marketplace.java | 164 + .../consumption/v2018_06_30/Marketplaces.java | 91 + .../consumption/v2018_06_30/MeterDetails.java | 156 + .../consumption/v2018_06_30/Notification.java | 181 + .../consumption/v2018_06_30/Operation.java | 30 + .../v2018_06_30/OperationDisplay.java | 62 + .../consumption/v2018_06_30/Operations.java | 27 + .../consumption/v2018_06_30/OperatorType.java | 44 + .../v2018_06_30/PriceSheetProperties.java | 155 + .../v2018_06_30/PriceSheetResult.java | 52 + .../consumption/v2018_06_30/PriceSheets.java | 36 + .../consumption/v2018_06_30/QueryOptions.java | 44 + .../v2018_06_30/ReservationDetail.java | 83 + .../ReservationRecommendation.java | 76 + .../ReservationRecommendations.java | 19 + .../v2018_06_30/ReservationSummary.java | 88 + .../v2018_06_30/ReservationsDetails.java | 38 + .../v2018_06_30/ReservationsSummaries.java | 38 + .../v2018_06_30/ResourceAttributes.java | 47 + .../consumption/v2018_06_30/Tags.java | 26 + .../consumption/v2018_06_30/TagsResult.java | 47 + .../v2018_06_30/TimeGrainType.java | 44 + .../consumption/v2018_06_30/UsageDetail.java | 179 + .../consumption/v2018_06_30/UsageDetails.java | 110 + .../implementation/AggregatedCostsImpl.java | 54 + .../implementation/AggregatedCostsInner.java | 223 + .../implementation/BalanceImpl.java | 127 + .../implementation/BalanceInner.java | 279 ++ .../implementation/BalancesImpl.java | 54 + .../implementation/BalancesInner.java | 223 + .../implementation/BudgetImpl.java | 182 + .../implementation/BudgetInner.java | 235 + .../implementation/BudgetsImpl.java | 215 + .../implementation/BudgetsInner.java | 1063 +++++ .../ConsumptionManagementClientImpl.java | 364 ++ .../implementation/ConsumptionManager.java | 243 ++ .../implementation/CostTagImpl.java | 53 + .../implementation/CostTagInner.java | 76 + .../implementation/CostTagsImpl.java | 54 + .../implementation/CostTagsInner.java | 228 + .../implementation/ForecastImpl.java | 87 + .../implementation/ForecastInner.java | 156 + .../implementation/ForecastsImpl.java | 68 + .../implementation/ForecastsInner.java | 223 + .../implementation/IdParsingUtils.java | 57 + ...nagementGroupAggregatedCostResultImpl.java | 79 + ...agementGroupAggregatedCostResultInner.java | 140 + .../implementation/MarketplaceImpl.java | 170 + .../implementation/MarketplaceInner.java | 401 ++ .../implementation/MarketplacesImpl.java | 175 + .../implementation/MarketplacesInner.java | 2937 +++++++++++++ .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 59 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 ++ .../v2018_06_30/implementation/PageImpl.java | 75 + .../v2018_06_30/implementation/PageImpl1.java | 75 + .../implementation/PriceSheetResultImpl.java | 59 + .../implementation/PriceSheetResultInner.java | 68 + .../implementation/PriceSheetsImpl.java | 54 + .../implementation/PriceSheetsInner.java | 382 ++ .../implementation/ReservationDetailImpl.java | 89 + .../ReservationDetailInner.java | 169 + .../ReservationRecommendationImpl.java | 93 + .../ReservationRecommendationInner.java | 248 ++ .../ReservationRecommendationsImpl.java | 71 + .../ReservationRecommendationsInner.java | 393 ++ .../ReservationSummaryImpl.java | 94 + .../ReservationSummaryInner.java | 188 + .../ReservationsDetailsImpl.java | 67 + .../ReservationsDetailsInner.java | 547 +++ .../ReservationsSummariesImpl.java | 68 + .../ReservationsSummariesInner.java | 794 ++++ .../v2018_06_30/implementation/TagInner.java | 43 + .../v2018_06_30/implementation/TagsImpl.java | 42 + .../v2018_06_30/implementation/TagsInner.java | 136 + .../implementation/TagsResultImpl.java | 52 + .../implementation/TagsResultInner.java | 75 + .../implementation/UsageDetailImpl.java | 186 + .../implementation/UsageDetailInner.java | 448 ++ .../implementation/UsageDetailsImpl.java | 211 + .../implementation/UsageDetailsInner.java | 3843 +++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2018_06_30/package-info.java | 11 + 111 files changed, 20746 insertions(+) create mode 100644 sdk/consumption/mgmt-v2018_06_30/pom.xml create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/AggregatedCosts.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Balance.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BalancePropertiesAdjustmentDetailsItem.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BalancePropertiesNewPurchasesDetailsItem.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Balances.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BillingFrequency.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Bound.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Budget.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BudgetTimePeriod.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Budgets.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CategoryType.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ChargeType.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTag.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTagProperties.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTags.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CurrentSpend.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Datagrain.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorDetails.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorResponse.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorResponseException.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Filters.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Forecast.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ForecastPropertiesConfidenceLevelsItem.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Forecasts.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Grain.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ManagementGroupAggregatedCostResult.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Marketplace.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Marketplaces.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/MeterDetails.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Notification.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Operation.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/OperationDisplay.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Operations.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/OperatorType.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheetProperties.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheetResult.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheets.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/QueryOptions.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationDetail.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationRecommendation.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationRecommendations.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationSummary.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationsDetails.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationsSummaries.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ResourceAttributes.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Tags.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/TagsResult.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/TimeGrainType.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/UsageDetail.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/UsageDetails.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/AggregatedCostsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/AggregatedCostsInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalanceImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalanceInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalancesImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalancesInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetsInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ConsumptionManager.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagsInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastsInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/IdParsingUtils.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ManagementGroupAggregatedCostResultImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ManagementGroupAggregatedCostResultInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplaceImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplaceInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplacesImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplacesInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationsInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PageImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PageImpl1.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetResultImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetResultInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetsInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationDetailImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationDetailInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationsInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationSummaryImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationSummaryInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsDetailsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsDetailsInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsSummariesImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsSummariesInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsResultImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsResultInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailsInner.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/package-info.java create mode 100644 sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/package-info.java diff --git a/sdk/consumption/mgmt-v2018_06_30/pom.xml b/sdk/consumption/mgmt-v2018_06_30/pom.xml new file mode 100644 index 0000000000000..6e1b2746956ee --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2018_06_30 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-consumption + 1.0.0-beta + jar + Microsoft Azure SDK for Consumption Management + This package contains Microsoft Consumption Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-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 + + 1.6.5 + + + + + + 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/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/AggregatedCosts.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/AggregatedCosts.java new file mode 100644 index 0000000000000..19af98452022b --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/AggregatedCosts.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.consumption.v2018_06_30; + +import rx.Observable; + +/** + * Type representing AggregatedCosts. + */ +public interface AggregatedCosts { + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByManagementGroupAsync(String managementGroupId); + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getForBillingPeriodByManagementGroupAsync(String managementGroupId, String billingPeriodName); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Balance.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Balance.java new file mode 100644 index 0000000000000..f9272f5ce74d2 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Balance.java @@ -0,0 +1,118 @@ +/** + * 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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.BalanceInner; +import java.util.List; +import java.math.BigDecimal; +import java.util.Map; + +/** + * Type representing Balance. + */ +public interface Balance extends HasInner, HasManager { + /** + * @return the adjustmentDetails value. + */ + List adjustmentDetails(); + + /** + * @return the adjustments value. + */ + BigDecimal adjustments(); + + /** + * @return the azureMarketplaceServiceCharges value. + */ + BigDecimal azureMarketplaceServiceCharges(); + + /** + * @return the beginningBalance value. + */ + BigDecimal beginningBalance(); + + /** + * @return the billingFrequency value. + */ + BillingFrequency billingFrequency(); + + /** + * @return the chargesBilledSeparately value. + */ + BigDecimal chargesBilledSeparately(); + + /** + * @return the currency value. + */ + String currency(); + + /** + * @return the endingBalance value. + */ + BigDecimal endingBalance(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the newPurchases value. + */ + BigDecimal newPurchases(); + + /** + * @return the newPurchasesDetails value. + */ + List newPurchasesDetails(); + + /** + * @return the priceHidden value. + */ + Boolean priceHidden(); + + /** + * @return the serviceOverage value. + */ + BigDecimal serviceOverage(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalOverage value. + */ + BigDecimal totalOverage(); + + /** + * @return the totalUsage value. + */ + BigDecimal totalUsage(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the utilized value. + */ + BigDecimal utilized(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BalancePropertiesAdjustmentDetailsItem.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BalancePropertiesAdjustmentDetailsItem.java new file mode 100644 index 0000000000000..bb4d6b4fcbe62 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BalancePropertiesAdjustmentDetailsItem.java @@ -0,0 +1,48 @@ +/** + * 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.consumption.v2018_06_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The BalancePropertiesAdjustmentDetailsItem model. + */ +public class BalancePropertiesAdjustmentDetailsItem { + /** + * the name of new adjustment. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * the value of new adjustment. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal value; + + /** + * Get the name of new adjustment. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the value of new adjustment. + * + * @return the value value + */ + public BigDecimal value() { + return this.value; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BalancePropertiesNewPurchasesDetailsItem.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BalancePropertiesNewPurchasesDetailsItem.java new file mode 100644 index 0000000000000..cea95f2be2627 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BalancePropertiesNewPurchasesDetailsItem.java @@ -0,0 +1,48 @@ +/** + * 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.consumption.v2018_06_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The BalancePropertiesNewPurchasesDetailsItem model. + */ +public class BalancePropertiesNewPurchasesDetailsItem { + /** + * the name of new purchase. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * the value of new purchase. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal value; + + /** + * Get the name of new purchase. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the value of new purchase. + * + * @return the value value + */ + public BigDecimal value() { + return this.value; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Balances.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Balances.java new file mode 100644 index 0000000000000..75124c79c7699 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Balances.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.consumption.v2018_06_30; + +import rx.Observable; + +/** + * Type representing Balances. + */ +public interface Balances { + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingAccountAsync(String billingAccountId); + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getForBillingPeriodByBillingAccountAsync(String billingAccountId, String billingPeriodName); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BillingFrequency.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BillingFrequency.java new file mode 100644 index 0000000000000..67ed545f5242b --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BillingFrequency.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.consumption.v2018_06_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingFrequency. + */ +public final class BillingFrequency extends ExpandableStringEnum { + /** Static value Month for BillingFrequency. */ + public static final BillingFrequency MONTH = fromString("Month"); + + /** Static value Quarter for BillingFrequency. */ + public static final BillingFrequency QUARTER = fromString("Quarter"); + + /** Static value Year for BillingFrequency. */ + public static final BillingFrequency YEAR = fromString("Year"); + + /** + * Creates or finds a BillingFrequency from its string representation. + * @param name a name to look for + * @return the corresponding BillingFrequency + */ + @JsonCreator + public static BillingFrequency fromString(String name) { + return fromString(name, BillingFrequency.class); + } + + /** + * @return known BillingFrequency values + */ + public static Collection values() { + return values(BillingFrequency.class); + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Bound.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Bound.java new file mode 100644 index 0000000000000..32bdd503ecb0a --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Bound.java @@ -0,0 +1,41 @@ +/** + * 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.consumption.v2018_06_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Bound. + */ +public final class Bound extends ExpandableStringEnum { + /** Static value Upper for Bound. */ + public static final Bound UPPER = fromString("Upper"); + + /** Static value Lower for Bound. */ + public static final Bound LOWER = fromString("Lower"); + + /** + * Creates or finds a Bound from its string representation. + * @param name a name to look for + * @return the corresponding Bound + */ + @JsonCreator + public static Bound fromString(String name) { + return fromString(name, Bound.class); + } + + /** + * @return known Bound values + */ + public static Collection values() { + return values(Bound.class); + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Budget.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Budget.java new file mode 100644 index 0000000000000..b31c5ff88121f --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Budget.java @@ -0,0 +1,249 @@ +/** + * 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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.BudgetInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import java.math.BigDecimal; +import java.util.Map; + +/** + * Type representing Budget. + */ +public interface Budget extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the amount value. + */ + BigDecimal amount(); + + /** + * @return the category value. + */ + CategoryType category(); + + /** + * @return the currentSpend value. + */ + CurrentSpend currentSpend(); + + /** + * @return the eTag value. + */ + String eTag(); + + /** + * @return the filters value. + */ + Filters filters(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the notifications value. + */ + Map notifications(); + + /** + * @return the timeGrain value. + */ + TimeGrainType timeGrain(); + + /** + * @return the timePeriod value. + */ + BudgetTimePeriod timePeriod(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Budget definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroupName, DefinitionStages.WithAmount, DefinitionStages.WithCategory, DefinitionStages.WithTimeGrain, DefinitionStages.WithTimePeriod, DefinitionStages.WithCreate { + } + + /** + * Grouping of Budget definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Budget definition. + */ + interface Blank extends WithResourceGroupName { + } + + /** + * The stage of the budget definition allowing to specify ResourceGroupName. + */ + interface WithResourceGroupName { + /** + * Specifies resourceGroupName. + * @param resourceGroupName Azure Resource Group Name + * @return the next definition stage + */ + WithAmount withResourceGroupName(String resourceGroupName); + } + + /** + * The stage of the budget definition allowing to specify Amount. + */ + interface WithAmount { + /** + * Specifies amount. + * @param amount The total amount of cost to track with the budget + * @return the next definition stage + */ + WithCategory withAmount(BigDecimal amount); + } + + /** + * The stage of the budget definition allowing to specify Category. + */ + interface WithCategory { + /** + * Specifies category. + * @param category The category of the budget, whether the budget tracks cost or usage. Possible values include: 'Cost', 'Usage' + * @return the next definition stage + */ + WithTimeGrain withCategory(CategoryType category); + } + + /** + * The stage of the budget definition allowing to specify TimeGrain. + */ + interface WithTimeGrain { + /** + * Specifies timeGrain. + * @param timeGrain The time covered by a budget. Tracking of the amount will be reset based on the time grain. Possible values include: 'Monthly', 'Quarterly', 'Annually' + * @return the next definition stage + */ + WithTimePeriod withTimeGrain(TimeGrainType timeGrain); + } + + /** + * The stage of the budget definition allowing to specify TimePeriod. + */ + interface WithTimePeriod { + /** + * Specifies timePeriod. + * @param timePeriod Has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than three months. Past start date should be selected within the timegrain period. There are no restrictions on the end date + * @return the next definition stage + */ + WithCreate withTimePeriod(BudgetTimePeriod timePeriod); + } + + /** + * The stage of the budget definition allowing to specify ETag. + */ + interface WithETag { + /** + * Specifies eTag. + * @param eTag eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not + * @return the next definition stage + */ + WithCreate withETag(String eTag); + } + + /** + * The stage of the budget definition allowing to specify Filters. + */ + interface WithFilters { + /** + * Specifies filters. + * @param filters May be used to filter budgets by resource group, resource, or meter + * @return the next definition stage + */ + WithCreate withFilters(Filters filters); + } + + /** + * The stage of the budget definition allowing to specify Notifications. + */ + interface WithNotifications { + /** + * Specifies notifications. + * @param notifications Dictionary of notifications associated with the budget. Budget can have up to five notifications + * @return the next definition stage + */ + WithCreate withNotifications(Map notifications); + } + + /** + * 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.WithETag, DefinitionStages.WithFilters, DefinitionStages.WithNotifications { + } + } + /** + * The template for a Budget update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithETag, UpdateStages.WithFilters, UpdateStages.WithNotifications { + } + + /** + * Grouping of Budget update stages. + */ + interface UpdateStages { + /** + * The stage of the budget update allowing to specify ETag. + */ + interface WithETag { + /** + * Specifies eTag. + * @param eTag eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not + * @return the next update stage + */ + Update withETag(String eTag); + } + + /** + * The stage of the budget update allowing to specify Filters. + */ + interface WithFilters { + /** + * Specifies filters. + * @param filters May be used to filter budgets by resource group, resource, or meter + * @return the next update stage + */ + Update withFilters(Filters filters); + } + + /** + * The stage of the budget update allowing to specify Notifications. + */ + interface WithNotifications { + /** + * Specifies notifications. + * @param notifications Dictionary of notifications associated with the budget. Budget can have up to five notifications + * @return the next update stage + */ + Update withNotifications(Map notifications); + } + + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BudgetTimePeriod.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BudgetTimePeriod.java new file mode 100644 index 0000000000000..6f1f9eb61b089 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/BudgetTimePeriod.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.consumption.v2018_06_30; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The start and end date for a budget. + */ +public class BudgetTimePeriod { + /** + * The start date for the budget. + */ + @JsonProperty(value = "startDate", required = true) + private DateTime startDate; + + /** + * The end date for the budget. If not provided, we default this to 10 + * years from the start date. + */ + @JsonProperty(value = "endDate") + private DateTime endDate; + + /** + * Get the start date for the budget. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set the start date for the budget. + * + * @param startDate the startDate value to set + * @return the BudgetTimePeriod object itself. + */ + public BudgetTimePeriod withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the end date for the budget. If not provided, we default this to 10 years from the start date. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set the end date for the budget. If not provided, we default this to 10 years from the start date. + * + * @param endDate the endDate value to set + * @return the BudgetTimePeriod object itself. + */ + public BudgetTimePeriod withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Budgets.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Budgets.java new file mode 100644 index 0000000000000..d79e58a4a6403 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Budgets.java @@ -0,0 +1,55 @@ +/** + * 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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.BudgetInner; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.BudgetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Budgets. + */ +public interface Budgets extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Gets the budget for a subscription by budget name. + * + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String budgetName); + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String budgetName, BudgetInner parameters); + + /** + * The operation to delete a budget. + * + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String budgetName); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CategoryType.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CategoryType.java new file mode 100644 index 0000000000000..f61cb7eed2160 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CategoryType.java @@ -0,0 +1,41 @@ +/** + * 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.consumption.v2018_06_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CategoryType. + */ +public final class CategoryType extends ExpandableStringEnum { + /** Static value Cost for CategoryType. */ + public static final CategoryType COST = fromString("Cost"); + + /** Static value Usage for CategoryType. */ + public static final CategoryType USAGE = fromString("Usage"); + + /** + * Creates or finds a CategoryType from its string representation. + * @param name a name to look for + * @return the corresponding CategoryType + */ + @JsonCreator + public static CategoryType fromString(String name) { + return fromString(name, CategoryType.class); + } + + /** + * @return known CategoryType values + */ + public static Collection values() { + return values(CategoryType.class); + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ChargeType.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ChargeType.java new file mode 100644 index 0000000000000..bfa666e4435ab --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ChargeType.java @@ -0,0 +1,41 @@ +/** + * 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.consumption.v2018_06_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ChargeType. + */ +public final class ChargeType extends ExpandableStringEnum { + /** Static value Actual for ChargeType. */ + public static final ChargeType ACTUAL = fromString("Actual"); + + /** Static value Forecast for ChargeType. */ + public static final ChargeType FORECAST = fromString("Forecast"); + + /** + * Creates or finds a ChargeType from its string representation. + * @param name a name to look for + * @return the corresponding ChargeType + */ + @JsonCreator + public static ChargeType fromString(String name) { + return fromString(name, ChargeType.class); + } + + /** + * @return known ChargeType values + */ + public static Collection values() { + return values(ChargeType.class); + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTag.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTag.java new file mode 100644 index 0000000000000..ff1fdb7eddde0 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTag.java @@ -0,0 +1,46 @@ +/** + * 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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.CostTagInner; +import java.util.List; + +/** + * Type representing CostTag. + */ +public interface CostTag extends HasInner, HasManager { + /** + * @return the costTags value. + */ + List costTags(); + + /** + * @return the eTag value. + */ + String eTag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTagProperties.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTagProperties.java new file mode 100644 index 0000000000000..3e1a277fa1215 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTagProperties.java @@ -0,0 +1,43 @@ +/** + * 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.consumption.v2018_06_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the cost tag. + */ +public class CostTagProperties { + /** + * Cost tag key. + */ + @JsonProperty(value = "key") + private String key; + + /** + * Get cost tag key. + * + * @return the key value + */ + public String key() { + return this.key; + } + + /** + * Set cost tag key. + * + * @param key the key value to set + * @return the CostTagProperties object itself. + */ + public CostTagProperties withKey(String key) { + this.key = key; + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTags.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTags.java new file mode 100644 index 0000000000000..9d2d591c5a8ee --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CostTags.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.consumption.v2018_06_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.CostTagInner; + +/** + * Type representing CostTags. + */ +public interface CostTags { + /** + * Get cost tags for a billing account. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountId); + + /** + * The operation to create or update cost tags associated with a billing account. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param billingAccountId BillingAccount ID + * @param parameters Parameters supplied to the Create cost tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createOrUpdateAsync(String billingAccountId, CostTagInner parameters); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CurrentSpend.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CurrentSpend.java new file mode 100644 index 0000000000000..5298a1ecece96 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/CurrentSpend.java @@ -0,0 +1,48 @@ +/** + * 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.consumption.v2018_06_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The current amount of cost which is being tracked for a budget. + */ +public class CurrentSpend { + /** + * The total amount of cost which is being tracked by the budget. + */ + @JsonProperty(value = "amount", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal amount; + + /** + * The unit of measure for the budget amount. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * Get the total amount of cost which is being tracked by the budget. + * + * @return the amount value + */ + public BigDecimal amount() { + return this.amount; + } + + /** + * Get the unit of measure for the budget amount. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Datagrain.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Datagrain.java new file mode 100644 index 0000000000000..e94e4ee0cc8c8 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * 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.consumption.v2018_06_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorDetails.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorDetails.java new file mode 100644 index 0000000000000..6cc28015b74dd --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorDetails.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.consumption.v2018_06_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorResponse.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorResponse.java new file mode 100644 index 0000000000000..914dd3c39efe9 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorResponse.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.consumption.v2018_06_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorResponseException.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorResponseException.java new file mode 100644 index 0000000000000..c41091fa71f84 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ErrorResponseException.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.consumption.v2018_06_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Filters.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Filters.java new file mode 100644 index 0000000000000..5a3a0985d56c8 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Filters.java @@ -0,0 +1,126 @@ +/** + * 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.consumption.v2018_06_30; + +import java.util.List; +import java.util.UUID; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * May be used to filter budgets by resource group, resource, or meter. + */ +public class Filters { + /** + * The list of filters on resource groups, allowed at subscription level + * only. + */ + @JsonProperty(value = "resourceGroups") + private List resourceGroups; + + /** + * The list of filters on resources. + */ + @JsonProperty(value = "resources") + private List resources; + + /** + * The list of filters on meters (GUID), mandatory for budgets of usage + * category. + */ + @JsonProperty(value = "meters") + private List meters; + + /** + * The dictionary of filters on tags. + */ + @JsonProperty(value = "tags") + private Map> tags; + + /** + * Get the list of filters on resource groups, allowed at subscription level only. + * + * @return the resourceGroups value + */ + public List resourceGroups() { + return this.resourceGroups; + } + + /** + * Set the list of filters on resource groups, allowed at subscription level only. + * + * @param resourceGroups the resourceGroups value to set + * @return the Filters object itself. + */ + public Filters withResourceGroups(List resourceGroups) { + this.resourceGroups = resourceGroups; + return this; + } + + /** + * Get the list of filters on resources. + * + * @return the resources value + */ + public List resources() { + return this.resources; + } + + /** + * Set the list of filters on resources. + * + * @param resources the resources value to set + * @return the Filters object itself. + */ + public Filters withResources(List resources) { + this.resources = resources; + return this; + } + + /** + * Get the list of filters on meters (GUID), mandatory for budgets of usage category. + * + * @return the meters value + */ + public List meters() { + return this.meters; + } + + /** + * Set the list of filters on meters (GUID), mandatory for budgets of usage category. + * + * @param meters the meters value to set + * @return the Filters object itself. + */ + public Filters withMeters(List meters) { + this.meters = meters; + return this; + } + + /** + * Get the dictionary of filters on tags. + * + * @return the tags value + */ + public Map> tags() { + return this.tags; + } + + /** + * Set the dictionary of filters on tags. + * + * @param tags the tags value to set + * @return the Filters object itself. + */ + public Filters withTags(Map> tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Forecast.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Forecast.java new file mode 100644 index 0000000000000..b518683c272d5 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Forecast.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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ForecastInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * Type representing Forecast. + */ +public interface Forecast extends HasInner, HasManager { + /** + * @return the charge value. + */ + BigDecimal charge(); + + /** + * @return the chargeType value. + */ + ChargeType chargeType(); + + /** + * @return the confidenceLevels value. + */ + List confidenceLevels(); + + /** + * @return the currency value. + */ + String currency(); + + /** + * @return the grain value. + */ + Grain grain(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + String usageDate(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ForecastPropertiesConfidenceLevelsItem.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ForecastPropertiesConfidenceLevelsItem.java new file mode 100644 index 0000000000000..30dd78a9b8267 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ForecastPropertiesConfidenceLevelsItem.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.consumption.v2018_06_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ForecastPropertiesConfidenceLevelsItem model. + */ +public class ForecastPropertiesConfidenceLevelsItem { + /** + * The percentage level of the confidence. + */ + @JsonProperty(value = "percentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal percentage; + + /** + * The boundary of the percentage, values could be 'Upper' or 'Lower'. + * Possible values include: 'Upper', 'Lower'. + */ + @JsonProperty(value = "bound") + private Bound bound; + + /** + * The amount of forecast within the percentage level. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal value; + + /** + * Get the percentage level of the confidence. + * + * @return the percentage value + */ + public BigDecimal percentage() { + return this.percentage; + } + + /** + * Get the boundary of the percentage, values could be 'Upper' or 'Lower'. Possible values include: 'Upper', 'Lower'. + * + * @return the bound value + */ + public Bound bound() { + return this.bound; + } + + /** + * Set the boundary of the percentage, values could be 'Upper' or 'Lower'. Possible values include: 'Upper', 'Lower'. + * + * @param bound the bound value to set + * @return the ForecastPropertiesConfidenceLevelsItem object itself. + */ + public ForecastPropertiesConfidenceLevelsItem withBound(Bound bound) { + this.bound = bound; + return this; + } + + /** + * Get the amount of forecast within the percentage level. + * + * @return the value value + */ + public BigDecimal value() { + return this.value; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Forecasts.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Forecasts.java new file mode 100644 index 0000000000000..8e75a55cf242d --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Forecasts.java @@ -0,0 +1,19 @@ +/** + * 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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ForecastsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Forecasts. + */ +public interface Forecasts extends SupportsListing, HasInner { +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Grain.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Grain.java new file mode 100644 index 0000000000000..a32fba8f0c336 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Grain.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.consumption.v2018_06_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Grain. + */ +public final class Grain extends ExpandableStringEnum { + /** Static value Daily for Grain. */ + public static final Grain DAILY = fromString("Daily"); + + /** Static value Monthly for Grain. */ + public static final Grain MONTHLY = fromString("Monthly"); + + /** Static value Yearly for Grain. */ + public static final Grain YEARLY = fromString("Yearly"); + + /** + * Creates or finds a Grain from its string representation. + * @param name a name to look for + * @return the corresponding Grain + */ + @JsonCreator + public static Grain fromString(String name) { + return fromString(name, Grain.class); + } + + /** + * @return known Grain values + */ + public static Collection values() { + return values(Grain.class); + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ManagementGroupAggregatedCostResult.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ManagementGroupAggregatedCostResult.java new file mode 100644 index 0000000000000..977a005c3cb12 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ManagementGroupAggregatedCostResult.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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ManagementGroupAggregatedCostResultInner; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * Type representing ManagementGroupAggregatedCostResult. + */ +public interface ManagementGroupAggregatedCostResult extends HasInner, HasManager { + /** + * @return the azureCharges value. + */ + BigDecimal azureCharges(); + + /** + * @return the billingPeriodId value. + */ + String billingPeriodId(); + + /** + * @return the chargesBilledSeparately value. + */ + BigDecimal chargesBilledSeparately(); + + /** + * @return the children value. + */ + List children(); + + /** + * @return the currency value. + */ + String currency(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the marketplaceCharges value. + */ + BigDecimal marketplaceCharges(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Marketplace.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Marketplace.java new file mode 100644 index 0000000000000..1f2865b51be7e --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Marketplace.java @@ -0,0 +1,164 @@ +/** + * 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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.MarketplaceInner; +import java.math.BigDecimal; +import java.util.UUID; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing Marketplace. + */ +public interface Marketplace extends HasInner, HasManager { + /** + * @return the accountName value. + */ + String accountName(); + + /** + * @return the additionalProperties value. + */ + String additionalProperties(); + + /** + * @return the billingPeriodId value. + */ + String billingPeriodId(); + + /** + * @return the consumedQuantity value. + */ + BigDecimal consumedQuantity(); + + /** + * @return the consumedService value. + */ + String consumedService(); + + /** + * @return the costCenter value. + */ + String costCenter(); + + /** + * @return the currency value. + */ + String currency(); + + /** + * @return the departmentName value. + */ + String departmentName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the instanceName value. + */ + String instanceName(); + + /** + * @return the isEstimated value. + */ + Boolean isEstimated(); + + /** + * @return the meterId value. + */ + UUID meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the offerName value. + */ + String offerName(); + + /** + * @return the orderNumber value. + */ + String orderNumber(); + + /** + * @return the planName value. + */ + String planName(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the publisherName value. + */ + String publisherName(); + + /** + * @return the resourceGroup value. + */ + String resourceGroup(); + + /** + * @return the resourceRate value. + */ + BigDecimal resourceRate(); + + /** + * @return the subscriptionGuid value. + */ + UUID subscriptionGuid(); + + /** + * @return the subscriptionName value. + */ + String subscriptionName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the unitOfMeasure value. + */ + String unitOfMeasure(); + + /** + * @return the usageEnd value. + */ + DateTime usageEnd(); + + /** + * @return the usageStart value. + */ + DateTime usageStart(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Marketplaces.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Marketplaces.java new file mode 100644 index 0000000000000..d49475d4d0fcb --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Marketplaces.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.consumption.v2018_06_30; + +import rx.Observable; + +/** + * Type representing Marketplaces. + */ +public interface Marketplaces { + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingPeriodAsync(final String billingPeriodName); + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountId); + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName); + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDepartmentAsync(final String departmentId); + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName); + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByEnrollmentAccountAsync(final String enrollmentAccountId); + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName); + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/MeterDetails.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/MeterDetails.java new file mode 100644 index 0000000000000..d321479231415 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/MeterDetails.java @@ -0,0 +1,156 @@ +/** + * 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.consumption.v2018_06_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * The name of the service. + */ + @JsonProperty(value = "serviceName", access = JsonProperty.Access.WRITE_ONLY) + private String serviceName; + + /** + * The service tier. + */ + @JsonProperty(value = "serviceTier", access = JsonProperty.Access.WRITE_ONLY) + private String serviceTier; + + /** + * Get the name of the meter, within the given meter category. + * + * @return the meterName value + */ + public String meterName() { + return this.meterName; + } + + /** + * Get the category of the meter, for example, 'Cloud services', 'Networking', etc.. + * + * @return the meterCategory value + */ + public String meterCategory() { + return this.meterCategory; + } + + /** + * Get the subcategory of the meter, for example, 'A6 Cloud services', 'ExpressRoute (IXP)', etc.. + * + * @return the meterSubCategory value + */ + public String meterSubCategory() { + return this.meterSubCategory; + } + + /** + * Get the unit in which the meter consumption is charged, for example, 'Hours', 'GB', etc. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Get the location in which the Azure service is available. + * + * @return the meterLocation value + */ + public String meterLocation() { + return this.meterLocation; + } + + /** + * Get the total included quantity associated with the offer. + * + * @return the totalIncludedQuantity value + */ + public BigDecimal totalIncludedQuantity() { + return this.totalIncludedQuantity; + } + + /** + * Get the pretax listing price. + * + * @return the pretaxStandardRate value + */ + public BigDecimal pretaxStandardRate() { + return this.pretaxStandardRate; + } + + /** + * Get the name of the service. + * + * @return the serviceName value + */ + public String serviceName() { + return this.serviceName; + } + + /** + * Get the service tier. + * + * @return the serviceTier value + */ + public String serviceTier() { + return this.serviceTier; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Notification.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Notification.java new file mode 100644 index 0000000000000..c56b824534454 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Notification.java @@ -0,0 +1,181 @@ +/** + * 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.consumption.v2018_06_30; + +import java.math.BigDecimal; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The notification associated with a budget. + */ +public class Notification { + /** + * The notification is enabled or not. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /** + * The comparison operator. Possible values include: 'EqualTo', + * 'GreaterThan', 'GreaterThanOrEqualTo'. + */ + @JsonProperty(value = "operator", required = true) + private OperatorType operator; + + /** + * Threshold value associated with a notification. Notification is sent + * when the cost exceeded the threshold. It is always percent and has to be + * between 0 and 1000. + */ + @JsonProperty(value = "threshold", required = true) + private BigDecimal threshold; + + /** + * Email addresses to send the budget notification to when the threshold is + * exceeded. + */ + @JsonProperty(value = "contactEmails", required = true) + private List contactEmails; + + /** + * Contact roles to send the budget notification to when the threshold is + * exceeded. + */ + @JsonProperty(value = "contactRoles") + private List contactRoles; + + /** + * Action groups to send the budget notification to when the threshold is + * exceeded. + */ + @JsonProperty(value = "contactGroups") + private List contactGroups; + + /** + * Get the notification is enabled or not. + * + * @return the enabled value + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the notification is enabled or not. + * + * @param enabled the enabled value to set + * @return the Notification object itself. + */ + public Notification withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the comparison operator. Possible values include: 'EqualTo', 'GreaterThan', 'GreaterThanOrEqualTo'. + * + * @return the operator value + */ + public OperatorType operator() { + return this.operator; + } + + /** + * Set the comparison operator. Possible values include: 'EqualTo', 'GreaterThan', 'GreaterThanOrEqualTo'. + * + * @param operator the operator value to set + * @return the Notification object itself. + */ + public Notification withOperator(OperatorType operator) { + this.operator = operator; + return this; + } + + /** + * Get threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0 and 1000. + * + * @return the threshold value + */ + public BigDecimal threshold() { + return this.threshold; + } + + /** + * Set threshold value associated with a notification. Notification is sent when the cost exceeded the threshold. It is always percent and has to be between 0 and 1000. + * + * @param threshold the threshold value to set + * @return the Notification object itself. + */ + public Notification withThreshold(BigDecimal threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get email addresses to send the budget notification to when the threshold is exceeded. + * + * @return the contactEmails value + */ + public List contactEmails() { + return this.contactEmails; + } + + /** + * Set email addresses to send the budget notification to when the threshold is exceeded. + * + * @param contactEmails the contactEmails value to set + * @return the Notification object itself. + */ + public Notification withContactEmails(List contactEmails) { + this.contactEmails = contactEmails; + return this; + } + + /** + * Get contact roles to send the budget notification to when the threshold is exceeded. + * + * @return the contactRoles value + */ + public List contactRoles() { + return this.contactRoles; + } + + /** + * Set contact roles to send the budget notification to when the threshold is exceeded. + * + * @param contactRoles the contactRoles value to set + * @return the Notification object itself. + */ + public Notification withContactRoles(List contactRoles) { + this.contactRoles = contactRoles; + return this; + } + + /** + * Get action groups to send the budget notification to when the threshold is exceeded. + * + * @return the contactGroups value + */ + public List contactGroups() { + return this.contactGroups; + } + + /** + * Set action groups to send the budget notification to when the threshold is exceeded. + * + * @param contactGroups the contactGroups value to set + * @return the Notification object itself. + */ + public Notification withContactGroups(List contactGroups) { + this.contactGroups = contactGroups; + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Operation.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Operation.java new file mode 100644 index 0000000000000..4199d0a139997 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Operation.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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/OperationDisplay.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/OperationDisplay.java new file mode 100644 index 0000000000000..952d14a3fd9af --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * 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.consumption.v2018_06_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Operations.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Operations.java new file mode 100644 index 0000000000000..f8b680eb797cb --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/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.consumption.v2018_06_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/OperatorType.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/OperatorType.java new file mode 100644 index 0000000000000..b2f0f30916e00 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/OperatorType.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.consumption.v2018_06_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for OperatorType. + */ +public final class OperatorType extends ExpandableStringEnum { + /** Static value EqualTo for OperatorType. */ + public static final OperatorType EQUAL_TO = fromString("EqualTo"); + + /** Static value GreaterThan for OperatorType. */ + public static final OperatorType GREATER_THAN = fromString("GreaterThan"); + + /** Static value GreaterThanOrEqualTo for OperatorType. */ + public static final OperatorType GREATER_THAN_OR_EQUAL_TO = fromString("GreaterThanOrEqualTo"); + + /** + * Creates or finds a OperatorType from its string representation. + * @param name a name to look for + * @return the corresponding OperatorType + */ + @JsonCreator + public static OperatorType fromString(String name) { + return fromString(name, OperatorType.class); + } + + /** + * @return known OperatorType values + */ + public static Collection values() { + return values(OperatorType.class); + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheetProperties.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheetProperties.java new file mode 100644 index 0000000000000..b27f7460d590f --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheetProperties.java @@ -0,0 +1,155 @@ +/** + * 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.consumption.v2018_06_30; + +import java.util.UUID; +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the price sheet. + */ +public class PriceSheetProperties { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The meter id (GUID). + */ + @JsonProperty(value = "meterId", access = JsonProperty.Access.WRITE_ONLY) + private UUID meterId; + + /** + * The details about the meter. By default this is not populated, unless + * it's specified in $expand. + */ + @JsonProperty(value = "meterDetails", access = JsonProperty.Access.WRITE_ONLY) + private MeterDetails meterDetails; + + /** + * Unit of measure. + */ + @JsonProperty(value = "unitOfMeasure", access = JsonProperty.Access.WRITE_ONLY) + private String unitOfMeasure; + + /** + * Included quality for an offer. + */ + @JsonProperty(value = "includedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal includedQuantity; + + /** + * Part Number. + */ + @JsonProperty(value = "partNumber", access = JsonProperty.Access.WRITE_ONLY) + private String partNumber; + + /** + * Unit Price. + */ + @JsonProperty(value = "unitPrice", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal unitPrice; + + /** + * Currency Code. + */ + @JsonProperty(value = "currencyCode", access = JsonProperty.Access.WRITE_ONLY) + private String currencyCode; + + /** + * Offer Id. + */ + @JsonProperty(value = "offerId", access = JsonProperty.Access.WRITE_ONLY) + private String offerId; + + /** + * Get the id of the billing period resource that the usage belongs to. + * + * @return the billingPeriodId value + */ + public String billingPeriodId() { + return this.billingPeriodId; + } + + /** + * Get the meter id (GUID). + * + * @return the meterId value + */ + public UUID meterId() { + return this.meterId; + } + + /** + * Get the details about the meter. By default this is not populated, unless it's specified in $expand. + * + * @return the meterDetails value + */ + public MeterDetails meterDetails() { + return this.meterDetails; + } + + /** + * Get unit of measure. + * + * @return the unitOfMeasure value + */ + public String unitOfMeasure() { + return this.unitOfMeasure; + } + + /** + * Get included quality for an offer. + * + * @return the includedQuantity value + */ + public BigDecimal includedQuantity() { + return this.includedQuantity; + } + + /** + * Get part Number. + * + * @return the partNumber value + */ + public String partNumber() { + return this.partNumber; + } + + /** + * Get unit Price. + * + * @return the unitPrice value + */ + public BigDecimal unitPrice() { + return this.unitPrice; + } + + /** + * Get currency Code. + * + * @return the currencyCode value + */ + public String currencyCode() { + return this.currencyCode; + } + + /** + * Get offer Id. + * + * @return the offerId value + */ + public String offerId() { + return this.offerId; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheetResult.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheetResult.java new file mode 100644 index 0000000000000..1170e694739f4 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheetResult.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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.PriceSheetResultInner; +import java.util.List; +import java.util.Map; + +/** + * Type representing PriceSheetResult. + */ +public interface PriceSheetResult extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the pricesheets value. + */ + List pricesheets(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheets.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheets.java new file mode 100644 index 0000000000000..7d36ff900f2d8 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/PriceSheets.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.consumption.v2018_06_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.PriceSheetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PriceSheets. + */ +public interface PriceSheets extends HasInner { + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(); + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingPeriodAsync(String billingPeriodName); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/QueryOptions.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/QueryOptions.java new file mode 100644 index 0000000000000..663f6b769ef0c --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/QueryOptions.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.consumption.v2018_06_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Additional parameters for a set of operations. + */ +public class QueryOptions { + /** + * OData apply expression to aggregate usageDetails by tags or (tags and + * properties/usageStart). + */ + @JsonProperty(value = "") + private String apply; + + /** + * Get oData apply expression to aggregate usageDetails by tags or (tags and properties/usageStart). + * + * @return the apply value + */ + public String apply() { + return this.apply; + } + + /** + * Set oData apply expression to aggregate usageDetails by tags or (tags and properties/usageStart). + * + * @param apply the apply value to set + * @return the QueryOptions object itself. + */ + public QueryOptions withApply(String apply) { + this.apply = apply; + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationDetail.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationDetail.java new file mode 100644 index 0000000000000..243ea7d5a8fb2 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationDetail.java @@ -0,0 +1,83 @@ +/** + * 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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ReservationDetailInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetail. + */ +public interface ReservationDetail extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationRecommendation.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationRecommendation.java new file mode 100644 index 0000000000000..5ef3fa3df1586 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationRecommendation.java @@ -0,0 +1,76 @@ +/** + * 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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.UUID; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ReservationRecommendationInner; + +/** + * Type representing ReservationRecommendation. + */ +public interface ReservationRecommendation extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, HasManager { + /** + * @return the costWithNoReservedInstances value. + */ + BigDecimal costWithNoReservedInstances(); + + /** + * @return the firstUsageDate value. + */ + DateTime firstUsageDate(); + + /** + * @return the lookBackPeriod value. + */ + String lookBackPeriod(); + + /** + * @return the meterId value. + */ + UUID meterId(); + + /** + * @return the netSavings value. + */ + BigDecimal netSavings(); + + /** + * @return the recommendedQuantity value. + */ + BigDecimal recommendedQuantity(); + + /** + * @return the scope value. + */ + String scope(); + + /** + * @return the sku value. + */ + String sku(); + + /** + * @return the term value. + */ + String term(); + + /** + * @return the totalCostWithReservedInstances value. + */ + BigDecimal totalCostWithReservedInstances(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationRecommendations.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationRecommendations.java new file mode 100644 index 0000000000000..1cf76c52794f6 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationRecommendations.java @@ -0,0 +1,19 @@ +/** + * 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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ReservationRecommendationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationRecommendations. + */ +public interface ReservationRecommendations extends SupportsListing, HasInner { +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationSummary.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationSummary.java new file mode 100644 index 0000000000000..58bcbfb829d7f --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationSummary.java @@ -0,0 +1,88 @@ +/** + * 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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ReservationSummaryInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummary. + */ +public interface ReservationSummary extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationsDetails.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationsDetails.java new file mode 100644 index 0000000000000..1d8b9d20b840b --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationsDetails.java @@ -0,0 +1,38 @@ +/** + * 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.consumption.v2018_06_30; + +import rx.Observable; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails { + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByReservationOrderAsync(final String reservationOrderId, final String filter); + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByReservationOrderAndReservationAsync(final String reservationOrderId, final String reservationId, final String filter); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationsSummaries.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationsSummaries.java new file mode 100644 index 0000000000000..8ba6256a98080 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ReservationsSummaries.java @@ -0,0 +1,38 @@ +/** + * 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.consumption.v2018_06_30; + +import rx.Observable; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByReservationOrderAsync(final String reservationOrderId, final Datagrain grain); + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByReservationOrderAndReservationAsync(final String reservationOrderId, final String reservationId, final Datagrain grain); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ResourceAttributes.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ResourceAttributes.java new file mode 100644 index 0000000000000..ed8d379dcb695 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/ResourceAttributes.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.consumption.v2018_06_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Resource model definition. + */ +public class ResourceAttributes { + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Resource sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private String sku; + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get resource sku. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Tags.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Tags.java new file mode 100644 index 0000000000000..891e126bee229 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/Tags.java @@ -0,0 +1,26 @@ +/** + * 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.consumption.v2018_06_30; + +import rx.Observable; + +/** + * Type representing Tags. + */ +public interface Tags { + /** + * Get all available tag keys for a billing account. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountId); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/TagsResult.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/TagsResult.java new file mode 100644 index 0000000000000..03344cce516cb --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/TagsResult.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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.TagsResultInner; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.TagInner; +import java.util.List; + +/** + * Type representing TagsResult. + */ +public interface TagsResult extends HasInner, HasManager { + /** + * @return the eTag value. + */ + String eTag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the tags value. + */ + List tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/TimeGrainType.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/TimeGrainType.java new file mode 100644 index 0000000000000..3508c73ea94d0 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/TimeGrainType.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.consumption.v2018_06_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TimeGrainType. + */ +public final class TimeGrainType extends ExpandableStringEnum { + /** Static value Monthly for TimeGrainType. */ + public static final TimeGrainType MONTHLY = fromString("Monthly"); + + /** Static value Quarterly for TimeGrainType. */ + public static final TimeGrainType QUARTERLY = fromString("Quarterly"); + + /** Static value Annually for TimeGrainType. */ + public static final TimeGrainType ANNUALLY = fromString("Annually"); + + /** + * Creates or finds a TimeGrainType from its string representation. + * @param name a name to look for + * @return the corresponding TimeGrainType + */ + @JsonCreator + public static TimeGrainType fromString(String name) { + return fromString(name, TimeGrainType.class); + } + + /** + * @return known TimeGrainType values + */ + public static Collection values() { + return values(TimeGrainType.class); + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/UsageDetail.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/UsageDetail.java new file mode 100644 index 0000000000000..26f75e84547a0 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/UsageDetail.java @@ -0,0 +1,179 @@ +/** + * 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.consumption.v2018_06_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_06_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +import java.util.UUID; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing UsageDetail. + */ +public interface UsageDetail extends HasInner, HasManager { + /** + * @return the accountName value. + */ + String accountName(); + + /** + * @return the additionalProperties value. + */ + String additionalProperties(); + + /** + * @return the billableQuantity value. + */ + BigDecimal billableQuantity(); + + /** + * @return the billingPeriodId value. + */ + String billingPeriodId(); + + /** + * @return the chargesBilledSeparately value. + */ + Boolean chargesBilledSeparately(); + + /** + * @return the consumedService value. + */ + String consumedService(); + + /** + * @return the costCenter value. + */ + String costCenter(); + + /** + * @return the currency value. + */ + String currency(); + + /** + * @return the departmentName value. + */ + String departmentName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the instanceLocation value. + */ + String instanceLocation(); + + /** + * @return the instanceName value. + */ + String instanceName(); + + /** + * @return the invoiceId value. + */ + String invoiceId(); + + /** + * @return the isEstimated value. + */ + Boolean isEstimated(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the meterDetails value. + */ + MeterDetails meterDetails(); + + /** + * @return the meterId value. + */ + UUID meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the offerId value. + */ + String offerId(); + + /** + * @return the partNumber value. + */ + String partNumber(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the resourceGuid value. + */ + String resourceGuid(); + + /** + * @return the subscriptionGuid value. + */ + UUID subscriptionGuid(); + + /** + * @return the subscriptionName value. + */ + String subscriptionName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageEnd value. + */ + DateTime usageEnd(); + + /** + * @return the usageQuantity value. + */ + BigDecimal usageQuantity(); + + /** + * @return the usageStart value. + */ + DateTime usageStart(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/UsageDetails.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/UsageDetails.java new file mode 100644 index 0000000000000..91a5f12f26175 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/UsageDetails.java @@ -0,0 +1,110 @@ +/** + * 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.consumption.v2018_06_30; + +import rx.Observable; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails { + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingPeriodAsync(final String billingPeriodName); + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountId); + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName); + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDepartmentAsync(final String departmentId); + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName); + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByEnrollmentAccountAsync(final String enrollmentAccountId); + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName); + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByManagementGroupAsync(final String managementGroupId); + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listForBillingPeriodByManagementGroupAsync(final String managementGroupId, final String billingPeriodName); + + /** + * Lists the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/AggregatedCostsImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/AggregatedCostsImpl.java new file mode 100644 index 0000000000000..ee5a4f07340c2 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/AggregatedCostsImpl.java @@ -0,0 +1,54 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.AggregatedCosts; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_06_30.ManagementGroupAggregatedCostResult; + +class AggregatedCostsImpl extends WrapperImpl implements AggregatedCosts { + private final ConsumptionManager manager; + + AggregatedCostsImpl(ConsumptionManager manager) { + super(manager.inner().aggregatedCosts()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable getByManagementGroupAsync(String managementGroupId) { + AggregatedCostsInner client = this.inner(); + return client.getByManagementGroupAsync(managementGroupId) + .map(new Func1() { + @Override + public ManagementGroupAggregatedCostResult call(ManagementGroupAggregatedCostResultInner inner) { + return new ManagementGroupAggregatedCostResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getForBillingPeriodByManagementGroupAsync(String managementGroupId, String billingPeriodName) { + AggregatedCostsInner client = this.inner(); + return client.getForBillingPeriodByManagementGroupAsync(managementGroupId, billingPeriodName) + .map(new Func1() { + @Override + public ManagementGroupAggregatedCostResult call(ManagementGroupAggregatedCostResultInner inner) { + return new ManagementGroupAggregatedCostResultImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/AggregatedCostsInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/AggregatedCostsInner.java new file mode 100644 index 0000000000000..38be5914af846 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/AggregatedCostsInner.java @@ -0,0 +1,223 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 AggregatedCosts. + */ +public class AggregatedCostsInner { + /** The Retrofit service to perform REST calls. */ + private AggregatedCostsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of AggregatedCostsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AggregatedCostsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(AggregatedCostsService.class); + this.client = client; + } + + /** + * The interface defining all the services for AggregatedCosts to be + * used by Retrofit to perform actually REST calls. + */ + interface AggregatedCostsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.AggregatedCosts getByManagementGroup" }) + @GET("providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/aggregatedcost") + Observable> getByManagementGroup(@Path("managementGroupId") String managementGroupId, @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.consumption.v2018_06_30.AggregatedCosts getForBillingPeriodByManagementGroup" }) + @GET("providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/Microsoft.Consumption/aggregatedcost") + Observable> getForBillingPeriodByManagementGroup(@Path("managementGroupId") String managementGroupId, @Path("billingPeriodName") String billingPeriodName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagementGroupAggregatedCostResultInner object if successful. + */ + public ManagementGroupAggregatedCostResultInner getByManagementGroup(String managementGroupId) { + return getByManagementGroupWithServiceResponseAsync(managementGroupId).toBlocking().single().body(); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group 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 getByManagementGroupAsync(String managementGroupId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByManagementGroupWithServiceResponseAsync(managementGroupId), serviceCallback); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupAggregatedCostResultInner object + */ + public Observable getByManagementGroupAsync(String managementGroupId) { + return getByManagementGroupWithServiceResponseAsync(managementGroupId).map(new Func1, ManagementGroupAggregatedCostResultInner>() { + @Override + public ManagementGroupAggregatedCostResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by current billing period. + * + * @param managementGroupId Azure Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupAggregatedCostResultInner object + */ + public Observable> getByManagementGroupWithServiceResponseAsync(String managementGroupId) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId 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.getByManagementGroup(managementGroupId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ManagementGroupAggregatedCostResultInner object if successful. + */ + public ManagementGroupAggregatedCostResultInner getForBillingPeriodByManagementGroup(String managementGroupId, String billingPeriodName) { + return getForBillingPeriodByManagementGroupWithServiceResponseAsync(managementGroupId, billingPeriodName).toBlocking().single().body(); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @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 getForBillingPeriodByManagementGroupAsync(String managementGroupId, String billingPeriodName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getForBillingPeriodByManagementGroupWithServiceResponseAsync(managementGroupId, billingPeriodName), serviceCallback); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupAggregatedCostResultInner object + */ + public Observable getForBillingPeriodByManagementGroupAsync(String managementGroupId, String billingPeriodName) { + return getForBillingPeriodByManagementGroupWithServiceResponseAsync(managementGroupId, billingPeriodName).map(new Func1, ManagementGroupAggregatedCostResultInner>() { + @Override + public ManagementGroupAggregatedCostResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Provides the aggregate cost of a management group and all child management groups by specified billing period. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ManagementGroupAggregatedCostResultInner object + */ + public Observable> getForBillingPeriodByManagementGroupWithServiceResponseAsync(String managementGroupId, String billingPeriodName) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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.getForBillingPeriodByManagementGroup(managementGroupId, billingPeriodName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getForBillingPeriodByManagementGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getForBillingPeriodByManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalanceImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalanceImpl.java new file mode 100644 index 0000000000000..358c078ddaff8 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalanceImpl.java @@ -0,0 +1,127 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.Balance; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_06_30.BalancePropertiesAdjustmentDetailsItem; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2018_06_30.BillingFrequency; +import com.microsoft.azure.management.consumption.v2018_06_30.BalancePropertiesNewPurchasesDetailsItem; +import java.util.Map; + +class BalanceImpl extends WrapperImpl implements Balance { + private final ConsumptionManager manager; + BalanceImpl(BalanceInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public List adjustmentDetails() { + return this.inner().adjustmentDetails(); + } + + @Override + public BigDecimal adjustments() { + return this.inner().adjustments(); + } + + @Override + public BigDecimal azureMarketplaceServiceCharges() { + return this.inner().azureMarketplaceServiceCharges(); + } + + @Override + public BigDecimal beginningBalance() { + return this.inner().beginningBalance(); + } + + @Override + public BillingFrequency billingFrequency() { + return this.inner().billingFrequency(); + } + + @Override + public BigDecimal chargesBilledSeparately() { + return this.inner().chargesBilledSeparately(); + } + + @Override + public String currency() { + return this.inner().currency(); + } + + @Override + public BigDecimal endingBalance() { + return this.inner().endingBalance(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal newPurchases() { + return this.inner().newPurchases(); + } + + @Override + public List newPurchasesDetails() { + return this.inner().newPurchasesDetails(); + } + + @Override + public Boolean priceHidden() { + return this.inner().priceHidden(); + } + + @Override + public BigDecimal serviceOverage() { + return this.inner().serviceOverage(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalOverage() { + return this.inner().totalOverage(); + } + + @Override + public BigDecimal totalUsage() { + return this.inner().totalUsage(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BigDecimal utilized() { + return this.inner().utilized(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalanceInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalanceInner.java new file mode 100644 index 0000000000000..e2ed2032da473 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalanceInner.java @@ -0,0 +1,279 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2018_06_30.BillingFrequency; +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_06_30.BalancePropertiesNewPurchasesDetailsItem; +import com.microsoft.azure.management.consumption.v2018_06_30.BalancePropertiesAdjustmentDetailsItem; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A balance resource. + */ +@JsonFlatten +public class BalanceInner extends ProxyResource { + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The beginning balance for the billing period. + */ + @JsonProperty(value = "properties.beginningBalance", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal beginningBalance; + + /** + * The ending balance for the billing period (for open periods this will be + * updated daily). + */ + @JsonProperty(value = "properties.endingBalance", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal endingBalance; + + /** + * Total new purchase amount. + */ + @JsonProperty(value = "properties.newPurchases", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal newPurchases; + + /** + * Total adjustment amount. + */ + @JsonProperty(value = "properties.adjustments", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal adjustments; + + /** + * Total Commitment usage. + */ + @JsonProperty(value = "properties.utilized", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal utilized; + + /** + * Overage for Azure services. + */ + @JsonProperty(value = "properties.serviceOverage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal serviceOverage; + + /** + * Charges Billed separately. + */ + @JsonProperty(value = "properties.chargesBilledSeparately", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal chargesBilledSeparately; + + /** + * serviceOverage + chargesBilledSeparately. + */ + @JsonProperty(value = "properties.totalOverage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalOverage; + + /** + * Azure service commitment + total Overage. + */ + @JsonProperty(value = "properties.totalUsage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalUsage; + + /** + * Total charges for Azure Marketplace. + */ + @JsonProperty(value = "properties.azureMarketplaceServiceCharges", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal azureMarketplaceServiceCharges; + + /** + * The billing frequency. Possible values include: 'Month', 'Quarter', + * 'Year'. + */ + @JsonProperty(value = "properties.billingFrequency") + private BillingFrequency billingFrequency; + + /** + * Price is hidden or not. + */ + @JsonProperty(value = "properties.priceHidden", access = JsonProperty.Access.WRITE_ONLY) + private Boolean priceHidden; + + /** + * List of new purchases. + */ + @JsonProperty(value = "properties.newPurchasesDetails", access = JsonProperty.Access.WRITE_ONLY) + private List newPurchasesDetails; + + /** + * List of Adjustments (Promo credit, SIE credit etc.). + */ + @JsonProperty(value = "properties.adjustmentDetails", access = JsonProperty.Access.WRITE_ONLY) + private List adjustmentDetails; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get the beginning balance for the billing period. + * + * @return the beginningBalance value + */ + public BigDecimal beginningBalance() { + return this.beginningBalance; + } + + /** + * Get the ending balance for the billing period (for open periods this will be updated daily). + * + * @return the endingBalance value + */ + public BigDecimal endingBalance() { + return this.endingBalance; + } + + /** + * Get total new purchase amount. + * + * @return the newPurchases value + */ + public BigDecimal newPurchases() { + return this.newPurchases; + } + + /** + * Get total adjustment amount. + * + * @return the adjustments value + */ + public BigDecimal adjustments() { + return this.adjustments; + } + + /** + * Get total Commitment usage. + * + * @return the utilized value + */ + public BigDecimal utilized() { + return this.utilized; + } + + /** + * Get overage for Azure services. + * + * @return the serviceOverage value + */ + public BigDecimal serviceOverage() { + return this.serviceOverage; + } + + /** + * Get charges Billed separately. + * + * @return the chargesBilledSeparately value + */ + public BigDecimal chargesBilledSeparately() { + return this.chargesBilledSeparately; + } + + /** + * Get serviceOverage + chargesBilledSeparately. + * + * @return the totalOverage value + */ + public BigDecimal totalOverage() { + return this.totalOverage; + } + + /** + * Get azure service commitment + total Overage. + * + * @return the totalUsage value + */ + public BigDecimal totalUsage() { + return this.totalUsage; + } + + /** + * Get total charges for Azure Marketplace. + * + * @return the azureMarketplaceServiceCharges value + */ + public BigDecimal azureMarketplaceServiceCharges() { + return this.azureMarketplaceServiceCharges; + } + + /** + * Get the billing frequency. Possible values include: 'Month', 'Quarter', 'Year'. + * + * @return the billingFrequency value + */ + public BillingFrequency billingFrequency() { + return this.billingFrequency; + } + + /** + * Set the billing frequency. Possible values include: 'Month', 'Quarter', 'Year'. + * + * @param billingFrequency the billingFrequency value to set + * @return the BalanceInner object itself. + */ + public BalanceInner withBillingFrequency(BillingFrequency billingFrequency) { + this.billingFrequency = billingFrequency; + return this; + } + + /** + * Get price is hidden or not. + * + * @return the priceHidden value + */ + public Boolean priceHidden() { + return this.priceHidden; + } + + /** + * Get list of new purchases. + * + * @return the newPurchasesDetails value + */ + public List newPurchasesDetails() { + return this.newPurchasesDetails; + } + + /** + * Get list of Adjustments (Promo credit, SIE credit etc.). + * + * @return the adjustmentDetails value + */ + public List adjustmentDetails() { + return this.adjustmentDetails; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalancesImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalancesImpl.java new file mode 100644 index 0000000000000..0a7c52400b5ce --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalancesImpl.java @@ -0,0 +1,54 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.Balances; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_06_30.Balance; + +class BalancesImpl extends WrapperImpl implements Balances { + private final ConsumptionManager manager; + + BalancesImpl(ConsumptionManager manager) { + super(manager.inner().balances()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable getByBillingAccountAsync(String billingAccountId) { + BalancesInner client = this.inner(); + return client.getByBillingAccountAsync(billingAccountId) + .map(new Func1() { + @Override + public Balance call(BalanceInner inner) { + return new BalanceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getForBillingPeriodByBillingAccountAsync(String billingAccountId, String billingPeriodName) { + BalancesInner client = this.inner(); + return client.getForBillingPeriodByBillingAccountAsync(billingAccountId, billingPeriodName) + .map(new Func1() { + @Override + public Balance call(BalanceInner inner) { + return new BalanceImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalancesInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalancesInner.java new file mode 100644 index 0000000000000..6846a6ecebdcb --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BalancesInner.java @@ -0,0 +1,223 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 Balances. + */ +public class BalancesInner { + /** The Retrofit service to perform REST calls. */ + private BalancesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of BalancesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BalancesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(BalancesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Balances to be + * used by Retrofit to perform actually REST calls. + */ + interface BalancesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.Balances getByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/balances") + Observable> getByBillingAccount(@Path("billingAccountId") String billingAccountId, @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.consumption.v2018_06_30.Balances getForBillingPeriodByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/balances") + Observable> getForBillingPeriodByBillingAccount(@Path("billingAccountId") String billingAccountId, @Path("billingPeriodName") String billingPeriodName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BalanceInner object if successful. + */ + public BalanceInner getByBillingAccount(String billingAccountId) { + return getByBillingAccountWithServiceResponseAsync(billingAccountId).toBlocking().single().body(); + } + + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount 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 getByBillingAccountAsync(String billingAccountId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingAccountWithServiceResponseAsync(billingAccountId), serviceCallback); + } + + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BalanceInner object + */ + public Observable getByBillingAccountAsync(String billingAccountId) { + return getByBillingAccountWithServiceResponseAsync(billingAccountId).map(new Func1, BalanceInner>() { + @Override + public BalanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BalanceInner object + */ + public Observable> getByBillingAccountWithServiceResponseAsync(String billingAccountId) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId 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.getByBillingAccount(billingAccountId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BalanceInner object if successful. + */ + public BalanceInner getForBillingPeriodByBillingAccount(String billingAccountId, String billingPeriodName) { + return getForBillingPeriodByBillingAccountWithServiceResponseAsync(billingAccountId, billingPeriodName).toBlocking().single().body(); + } + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @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 getForBillingPeriodByBillingAccountAsync(String billingAccountId, String billingPeriodName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getForBillingPeriodByBillingAccountWithServiceResponseAsync(billingAccountId, billingPeriodName), serviceCallback); + } + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BalanceInner object + */ + public Observable getForBillingPeriodByBillingAccountAsync(String billingAccountId, String billingPeriodName) { + return getForBillingPeriodByBillingAccountWithServiceResponseAsync(billingAccountId, billingPeriodName).map(new Func1, BalanceInner>() { + @Override + public BalanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the balances for a scope by billing period and billingAccountId. Balances are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BalanceInner object + */ + public Observable> getForBillingPeriodByBillingAccountWithServiceResponseAsync(String billingAccountId, String billingPeriodName) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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.getForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getForBillingPeriodByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getForBillingPeriodByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetImpl.java new file mode 100644 index 0000000000000..4e30b8e4f7e2c --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetImpl.java @@ -0,0 +1,182 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.Budget; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_06_30.CategoryType; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2018_06_30.TimeGrainType; +import com.microsoft.azure.management.consumption.v2018_06_30.BudgetTimePeriod; +import com.microsoft.azure.management.consumption.v2018_06_30.Filters; +import com.microsoft.azure.management.consumption.v2018_06_30.CurrentSpend; +import java.util.Map; +import com.microsoft.azure.management.consumption.v2018_06_30.Notification; + +class BudgetImpl extends CreatableUpdatableImpl implements Budget, Budget.Definition, Budget.Update { + private String resourceGroupName; + private String budgetName; + private final ConsumptionManager manager; + + BudgetImpl(String name, ConsumptionManager manager) { + super(name, new BudgetInner()); + this.manager = manager; + // Set resource name + this.budgetName = name; + // + } + + BudgetImpl(BudgetInner inner, ConsumptionManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.budgetName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.budgetName = IdParsingUtils.getValueFromIdByName(inner.id(), "budgets"); + // set other parameters for create and update + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + BudgetsInner client = this.manager().inner().budgets(); + return client.createOrUpdateByResourceGroupNameAsync(this.resourceGroupName, this.budgetName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BudgetsInner client = this.manager().inner().budgets(); + return client.createOrUpdateByResourceGroupNameAsync(this.resourceGroupName, this.budgetName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BudgetsInner client = this.manager().inner().budgets(); + return client.getByResourceGroupAsync(this.resourceGroupName, this.budgetName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public BigDecimal amount() { + return this.inner().amount(); + } + + @Override + public CategoryType category() { + return this.inner().category(); + } + + @Override + public CurrentSpend currentSpend() { + return this.inner().currentSpend(); + } + + @Override + public String eTag() { + return this.inner().eTag(); + } + + @Override + public Filters filters() { + return this.inner().filters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map notifications() { + return this.inner().notifications(); + } + + @Override + public TimeGrainType timeGrain() { + return this.inner().timeGrain(); + } + + @Override + public BudgetTimePeriod timePeriod() { + return this.inner().timePeriod(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BudgetImpl withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public BudgetImpl withAmount(BigDecimal amount) { + this.inner().withAmount(amount); + return this; + } + + @Override + public BudgetImpl withCategory(CategoryType category) { + this.inner().withCategory(category); + return this; + } + + @Override + public BudgetImpl withTimeGrain(TimeGrainType timeGrain) { + this.inner().withTimeGrain(timeGrain); + return this; + } + + @Override + public BudgetImpl withTimePeriod(BudgetTimePeriod timePeriod) { + this.inner().withTimePeriod(timePeriod); + return this; + } + + @Override + public BudgetImpl withETag(String eTag) { + this.inner().withETag(eTag); + return this; + } + + @Override + public BudgetImpl withFilters(Filters filters) { + this.inner().withFilters(filters); + return this; + } + + @Override + public BudgetImpl withNotifications(Map notifications) { + this.inner().withNotifications(notifications); + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetInner.java new file mode 100644 index 0000000000000..e1c059556daea --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetInner.java @@ -0,0 +1,235 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.CategoryType; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2018_06_30.TimeGrainType; +import com.microsoft.azure.management.consumption.v2018_06_30.BudgetTimePeriod; +import com.microsoft.azure.management.consumption.v2018_06_30.Filters; +import com.microsoft.azure.management.consumption.v2018_06_30.CurrentSpend; +import java.util.Map; +import com.microsoft.azure.management.consumption.v2018_06_30.Notification; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A budget resource. + */ +@JsonFlatten +public class BudgetInner extends ProxyResource { + /** + * The category of the budget, whether the budget tracks cost or usage. + * Possible values include: 'Cost', 'Usage'. + */ + @JsonProperty(value = "properties.category", required = true) + private CategoryType category; + + /** + * The total amount of cost to track with the budget. + */ + @JsonProperty(value = "properties.amount", required = true) + private BigDecimal amount; + + /** + * The time covered by a budget. Tracking of the amount will be reset based + * on the time grain. Possible values include: 'Monthly', 'Quarterly', + * 'Annually'. + */ + @JsonProperty(value = "properties.timeGrain", required = true) + private TimeGrainType timeGrain; + + /** + * Has start and end date of the budget. The start date must be first of + * the month and should be less than the end date. Budget start date must + * be on or after June 1, 2017. Future start date should not be more than + * three months. Past start date should be selected within the timegrain + * period. There are no restrictions on the end date. + */ + @JsonProperty(value = "properties.timePeriod", required = true) + private BudgetTimePeriod timePeriod; + + /** + * May be used to filter budgets by resource group, resource, or meter. + */ + @JsonProperty(value = "properties.filters") + private Filters filters; + + /** + * The current amount of cost which is being tracked for a budget. + */ + @JsonProperty(value = "properties.currentSpend", access = JsonProperty.Access.WRITE_ONLY) + private CurrentSpend currentSpend; + + /** + * Dictionary of notifications associated with the budget. Budget can have + * up to five notifications. + */ + @JsonProperty(value = "properties.notifications") + private Map notifications; + + /** + * eTag of the resource. To handle concurrent update scenario, this field + * will be used to determine whether the user is updating the latest + * version or not. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * Get the category of the budget, whether the budget tracks cost or usage. Possible values include: 'Cost', 'Usage'. + * + * @return the category value + */ + public CategoryType category() { + return this.category; + } + + /** + * Set the category of the budget, whether the budget tracks cost or usage. Possible values include: 'Cost', 'Usage'. + * + * @param category the category value to set + * @return the BudgetInner object itself. + */ + public BudgetInner withCategory(CategoryType category) { + this.category = category; + return this; + } + + /** + * Get the total amount of cost to track with the budget. + * + * @return the amount value + */ + public BigDecimal amount() { + return this.amount; + } + + /** + * Set the total amount of cost to track with the budget. + * + * @param amount the amount value to set + * @return the BudgetInner object itself. + */ + public BudgetInner withAmount(BigDecimal amount) { + this.amount = amount; + return this; + } + + /** + * Get the time covered by a budget. Tracking of the amount will be reset based on the time grain. Possible values include: 'Monthly', 'Quarterly', 'Annually'. + * + * @return the timeGrain value + */ + public TimeGrainType timeGrain() { + return this.timeGrain; + } + + /** + * Set the time covered by a budget. Tracking of the amount will be reset based on the time grain. Possible values include: 'Monthly', 'Quarterly', 'Annually'. + * + * @param timeGrain the timeGrain value to set + * @return the BudgetInner object itself. + */ + public BudgetInner withTimeGrain(TimeGrainType timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than three months. Past start date should be selected within the timegrain period. There are no restrictions on the end date. + * + * @return the timePeriod value + */ + public BudgetTimePeriod timePeriod() { + return this.timePeriod; + } + + /** + * Set has start and end date of the budget. The start date must be first of the month and should be less than the end date. Budget start date must be on or after June 1, 2017. Future start date should not be more than three months. Past start date should be selected within the timegrain period. There are no restrictions on the end date. + * + * @param timePeriod the timePeriod value to set + * @return the BudgetInner object itself. + */ + public BudgetInner withTimePeriod(BudgetTimePeriod timePeriod) { + this.timePeriod = timePeriod; + return this; + } + + /** + * Get may be used to filter budgets by resource group, resource, or meter. + * + * @return the filters value + */ + public Filters filters() { + return this.filters; + } + + /** + * Set may be used to filter budgets by resource group, resource, or meter. + * + * @param filters the filters value to set + * @return the BudgetInner object itself. + */ + public BudgetInner withFilters(Filters filters) { + this.filters = filters; + return this; + } + + /** + * Get the current amount of cost which is being tracked for a budget. + * + * @return the currentSpend value + */ + public CurrentSpend currentSpend() { + return this.currentSpend; + } + + /** + * Get dictionary of notifications associated with the budget. Budget can have up to five notifications. + * + * @return the notifications value + */ + public Map notifications() { + return this.notifications; + } + + /** + * Set dictionary of notifications associated with the budget. Budget can have up to five notifications. + * + * @param notifications the notifications value to set + * @return the BudgetInner object itself. + */ + public BudgetInner withNotifications(Map notifications) { + this.notifications = notifications; + return this; + } + + /** + * Get eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. + * + * @param eTag the eTag value to set + * @return the BudgetInner object itself. + */ + public BudgetInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetsImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetsImpl.java new file mode 100644 index 0000000000000..418de665a0e47 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetsImpl.java @@ -0,0 +1,215 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.Budgets; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.azure.management.consumption.v2018_06_30.Budget; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class BudgetsImpl extends WrapperImpl implements Budgets { + private PagedListConverter converter; + private final ConsumptionManager manager; + + BudgetsImpl(ConsumptionManager manager) { + super(manager.inner().budgets()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(BudgetInner inner) { + return Observable.just((Budget) wrapModel(inner)); + } + }; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BudgetImpl define(String name) { + return wrapModel(name); + } + + private BudgetImpl wrapModel(BudgetInner inner) { + return new BudgetImpl(inner, manager()); + } + + private BudgetImpl wrapModel(String name) { + return new BudgetImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String budgetName) { + BudgetsInner client = this.inner(); + return client.getAsync(budgetName) + .map(new Func1() { + @Override + public Budget call(BudgetInner inner) { + return new BudgetImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAsync(String budgetName, BudgetInner parameters) { + BudgetsInner client = this.inner(); + return client.createOrUpdateAsync(budgetName, parameters) + .map(new Func1() { + @Override + public Budget call(BudgetInner inner) { + return new BudgetImpl(inner, manager()); + } + }); + } + + @Override + public Completable deleteAsync(String budgetName) { + BudgetsInner client = this.inner(); + return client.deleteAsync(budgetName).toCompletable(); + } + + @Override + public PagedList list() { + BudgetsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + BudgetsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Budget call(BudgetInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + BudgetsInner client = this.inner(); + return converter.convert(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + BudgetsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Budget call(BudgetInner inner) { + return wrapModel(inner); + } + }); + } + + private Observable getInnerAsync(String resourceGroupName, String name) { + BudgetsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + public Budget getByResourceGroup(String resourceGroupName, String name) { + return getByResourceGroupAsync(resourceGroupName, name).toBlocking().last(); + } + + @Override + public Observable getByResourceGroupAsync(String resourceGroupName, String name) { + return this.getInnerAsync(resourceGroupName, name).flatMap(new Func1> () { + @Override + public Observable call(BudgetInner innerT) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Budget)wrapModel(innerT)); + } + } + }); + } + + @Override + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String name, ServiceCallback callback) { + return ServiceFuture.fromBody(getByResourceGroupAsync(resourceGroupName, name), callback); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteByResourceGroupNameAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByResourceGroup(String resourceGroupName, String name) { + this.deleteByResourceGroupAsync(resourceGroupName, name).await(); + } + + @Override + public Completable deleteByResourceGroupAsync(String resourceGroupName, String name) { + return this.inner().deleteByResourceGroupNameAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public ServiceFuture deleteByResourceGroupAsync(String resourceGroupName, String name, ServiceCallback serviceCallback) { + return ServiceFuture.fromBody(deleteByResourceGroupAsync(resourceGroupName, name), serviceCallback); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetsInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetsInner.java new file mode 100644 index 0000000000000..14528ed59bf59 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/BudgetsInner.java @@ -0,0 +1,1063 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +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.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +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 Budgets. + */ +public class BudgetsInner implements InnerSupportsGet, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private BudgetsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of BudgetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BudgetsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(BudgetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Budgets to be + * used by Retrofit to perform actually REST calls. + */ + interface BudgetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.Budgets list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets") + 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.consumption.v2018_06_30.Budgets listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @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.consumption.v2018_06_30.Budgets get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("budgetName") String budgetName, @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.consumption.v2018_06_30.Budgets createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("budgetName") String budgetName, @Query("api-version") String apiVersion, @Body BudgetInner parameters, @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.consumption.v2018_06_30.Budgets delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/providers/Microsoft.Consumption/budgets/{budgetName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("budgetName") String budgetName, @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.consumption.v2018_06_30.Budgets getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets/{budgetName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("budgetName") String budgetName, @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.consumption.v2018_06_30.Budgets createOrUpdateByResourceGroupName" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets/{budgetName}") + Observable> createOrUpdateByResourceGroupName(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("budgetName") String budgetName, @Query("api-version") String apiVersion, @Body BudgetInner parameters, @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.consumption.v2018_06_30.Budgets deleteByResourceGroupName" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Consumption/budgets/{budgetName}", method = "DELETE", hasBody = true) + Observable> deleteByResourceGroupName(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("budgetName") String budgetName, @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.consumption.v2018_06_30.Budgets listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @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.consumption.v2018_06_30.Budgets listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all budgets for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<BudgetInner> 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 budgets for a subscription. + * + * @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 budgets for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BudgetInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all budgets for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BudgetInner> 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 budgets for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BudgetInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all budgets for a resource group under a subscription. + * + * @param resourceGroupName Azure Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<BudgetInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all budgets for a resource group under a subscription. + * + * @param resourceGroupName Azure Resource Group Name. + * @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> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all budgets for a resource group under a subscription. + * + * @param resourceGroupName Azure Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BudgetInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all budgets for a resource group under a subscription. + * + * @param resourceGroupName Azure Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BudgetInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .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(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all budgets for a resource group under a subscription. + * + ServiceResponse> * @param resourceGroupName Azure Resource Group Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BudgetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName 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(), resourceGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the budget for a subscription by budget name. + * + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BudgetInner object if successful. + */ + public BudgetInner get(String budgetName) { + return getWithServiceResponseAsync(budgetName).toBlocking().single().body(); + } + + /** + * Gets the budget for a subscription by budget name. + * + * @param budgetName Budget Name. + * @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 budgetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(budgetName), serviceCallback); + } + + /** + * Gets the budget for a subscription by budget name. + * + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BudgetInner object + */ + public Observable getAsync(String budgetName) { + return getWithServiceResponseAsync(budgetName).map(new Func1, BudgetInner>() { + @Override + public BudgetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the budget for a subscription by budget name. + * + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BudgetInner object + */ + public Observable> getWithServiceResponseAsync(String budgetName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (budgetName == null) { + throw new IllegalArgumentException("Parameter budgetName 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(this.client.subscriptionId(), budgetName, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BudgetInner object if successful. + */ + public BudgetInner createOrUpdate(String budgetName, BudgetInner parameters) { + return createOrUpdateWithServiceResponseAsync(budgetName, parameters).toBlocking().single().body(); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @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 createOrUpdateAsync(String budgetName, BudgetInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(budgetName, parameters), serviceCallback); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BudgetInner object + */ + public Observable createOrUpdateAsync(String budgetName, BudgetInner parameters) { + return createOrUpdateWithServiceResponseAsync(budgetName, parameters).map(new Func1, BudgetInner>() { + @Override + public BudgetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BudgetInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String budgetName, BudgetInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (budgetName == null) { + throw new IllegalArgumentException("Parameter budgetName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(this.client.subscriptionId(), budgetName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to delete a budget. + * + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 budgetName) { + deleteWithServiceResponseAsync(budgetName).toBlocking().single().body(); + } + + /** + * The operation to delete a budget. + * + * @param budgetName Budget Name. + * @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 budgetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(budgetName), serviceCallback); + } + + /** + * The operation to delete a budget. + * + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String budgetName) { + return deleteWithServiceResponseAsync(budgetName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to delete a budget. + * + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String budgetName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (budgetName == null) { + throw new IllegalArgumentException("Parameter budgetName 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(this.client.subscriptionId(), budgetName, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the budget for a resource group under a subscription by budget name. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BudgetInner object if successful. + */ + public BudgetInner getByResourceGroup(String resourceGroupName, String budgetName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, budgetName).toBlocking().single().body(); + } + + /** + * Gets the budget for a resource group under a subscription by budget name. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @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 getByResourceGroupAsync(String resourceGroupName, String budgetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, budgetName), serviceCallback); + } + + /** + * Gets the budget for a resource group under a subscription by budget name. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BudgetInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String budgetName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, budgetName).map(new Func1, BudgetInner>() { + @Override + public BudgetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the budget for a resource group under a subscription by budget name. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BudgetInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String budgetName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (budgetName == null) { + throw new IllegalArgumentException("Parameter budgetName 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.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, budgetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BudgetInner object if successful. + */ + public BudgetInner createOrUpdateByResourceGroupName(String resourceGroupName, String budgetName, BudgetInner parameters) { + return createOrUpdateByResourceGroupNameWithServiceResponseAsync(resourceGroupName, budgetName, parameters).toBlocking().single().body(); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @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 createOrUpdateByResourceGroupNameAsync(String resourceGroupName, String budgetName, BudgetInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateByResourceGroupNameWithServiceResponseAsync(resourceGroupName, budgetName, parameters), serviceCallback); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BudgetInner object + */ + public Observable createOrUpdateByResourceGroupNameAsync(String resourceGroupName, String budgetName, BudgetInner parameters) { + return createOrUpdateByResourceGroupNameWithServiceResponseAsync(resourceGroupName, budgetName, parameters).map(new Func1, BudgetInner>() { + @Override + public BudgetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to create or update a budget. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @param parameters Parameters supplied to the Create Budget operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BudgetInner object + */ + public Observable> createOrUpdateByResourceGroupNameWithServiceResponseAsync(String resourceGroupName, String budgetName, BudgetInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (budgetName == null) { + throw new IllegalArgumentException("Parameter budgetName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdateByResourceGroupName(this.client.subscriptionId(), resourceGroupName, budgetName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateByResourceGroupNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateByResourceGroupNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to delete a budget. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteByResourceGroupName(String resourceGroupName, String budgetName) { + deleteByResourceGroupNameWithServiceResponseAsync(resourceGroupName, budgetName).toBlocking().single().body(); + } + + /** + * The operation to delete a budget. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @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 deleteByResourceGroupNameAsync(String resourceGroupName, String budgetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByResourceGroupNameWithServiceResponseAsync(resourceGroupName, budgetName), serviceCallback); + } + + /** + * The operation to delete a budget. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteByResourceGroupNameAsync(String resourceGroupName, String budgetName) { + return deleteByResourceGroupNameWithServiceResponseAsync(resourceGroupName, budgetName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to delete a budget. + * + * @param resourceGroupName Azure Resource Group Name. + * @param budgetName Budget Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteByResourceGroupNameWithServiceResponseAsync(String resourceGroupName, String budgetName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (budgetName == null) { + throw new IllegalArgumentException("Parameter budgetName 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.deleteByResourceGroupName(this.client.subscriptionId(), resourceGroupName, budgetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByResourceGroupNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByResourceGroupNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all budgets for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<BudgetInner> 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 budgets for a subscription. + * + * @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 budgets for a subscription. + * + * @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<BudgetInner> 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 budgets for a subscription. + * + * @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<BudgetInner> 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 budgets for a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BudgetInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all budgets for a resource group under a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<BudgetInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all budgets for a resource group under a subscription. + * + * @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> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all budgets for a resource group under a subscription. + * + * @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<BudgetInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all budgets for a resource group under a subscription. + * + * @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<BudgetInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(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(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all budgets for a resource group under a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BudgetInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ConsumptionManagementClientImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 0000000000000..576717c37422b --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ConsumptionManagementClientImpl.java @@ -0,0 +1,364 @@ +/** + * 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.consumption.v2018_06_30.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 ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl 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; + } + + /** Version of the API to be used with the client request. The current version is 2018-06-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2018-06-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * 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 ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. 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 Whether a unique x-ms-client-request-id should be generated. 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 Whether a unique x-ms-client-request-id should be generated. 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 ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The MarketplacesInner object to access its operations. + */ + private MarketplacesInner marketplaces; + + /** + * Gets the MarketplacesInner object to access its operations. + * @return the MarketplacesInner object. + */ + public MarketplacesInner marketplaces() { + return this.marketplaces; + } + + /** + * The BalancesInner object to access its operations. + */ + private BalancesInner balances; + + /** + * Gets the BalancesInner object to access its operations. + * @return the BalancesInner object. + */ + public BalancesInner balances() { + return this.balances; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The ReservationRecommendationsInner object to access its operations. + */ + private ReservationRecommendationsInner reservationRecommendations; + + /** + * Gets the ReservationRecommendationsInner object to access its operations. + * @return the ReservationRecommendationsInner object. + */ + public ReservationRecommendationsInner reservationRecommendations() { + return this.reservationRecommendations; + } + + /** + * The BudgetsInner object to access its operations. + */ + private BudgetsInner budgets; + + /** + * Gets the BudgetsInner object to access its operations. + * @return the BudgetsInner object. + */ + public BudgetsInner budgets() { + return this.budgets; + } + + /** + * The PriceSheetsInner object to access its operations. + */ + private PriceSheetsInner priceSheets; + + /** + * Gets the PriceSheetsInner object to access its operations. + * @return the PriceSheetsInner object. + */ + public PriceSheetsInner priceSheets() { + return this.priceSheets; + } + + /** + * The CostTagsInner object to access its operations. + */ + private CostTagsInner costTags; + + /** + * Gets the CostTagsInner object to access its operations. + * @return the CostTagsInner object. + */ + public CostTagsInner costTags() { + return this.costTags; + } + + /** + * The TagsInner object to access its operations. + */ + private TagsInner tags; + + /** + * Gets the TagsInner object to access its operations. + * @return the TagsInner object. + */ + public TagsInner tags() { + return this.tags; + } + + /** + * The ForecastsInner object to access its operations. + */ + private ForecastsInner forecasts; + + /** + * Gets the ForecastsInner object to access its operations. + * @return the ForecastsInner object. + */ + public ForecastsInner forecasts() { + return this.forecasts; + } + + /** + * 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 AggregatedCostsInner object to access its operations. + */ + private AggregatedCostsInner aggregatedCosts; + + /** + * Gets the AggregatedCostsInner object to access its operations. + * @return the AggregatedCostsInner object. + */ + public AggregatedCostsInner aggregatedCosts() { + return this.aggregatedCosts; + } + + /** + * Initializes an instance of ConsumptionManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public ConsumptionManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of ConsumptionManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public ConsumptionManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of ConsumptionManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public ConsumptionManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-06-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.marketplaces = new MarketplacesInner(restClient().retrofit(), this); + this.balances = new BalancesInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(restClient().retrofit(), this); + this.reservationRecommendations = new ReservationRecommendationsInner(restClient().retrofit(), this); + this.budgets = new BudgetsInner(restClient().retrofit(), this); + this.priceSheets = new PriceSheetsInner(restClient().retrofit(), this); + this.costTags = new CostTagsInner(restClient().retrofit(), this); + this.tags = new TagsInner(restClient().retrofit(), this); + this.forecasts = new ForecastsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.aggregatedCosts = new AggregatedCostsInner(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, auto-generated)", super.userAgent(), "ConsumptionManagementClient", "2018-06-30"); + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ConsumptionManager.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ConsumptionManager.java new file mode 100644 index 0000000000000..af84c0fc0fe3c --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ConsumptionManager.java @@ -0,0 +1,243 @@ +/** + * 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.consumption.v2018_06_30.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.consumption.v2018_06_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2018_06_30.Marketplaces; +import com.microsoft.azure.management.consumption.v2018_06_30.Balances; +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationRecommendations; +import com.microsoft.azure.management.consumption.v2018_06_30.Budgets; +import com.microsoft.azure.management.consumption.v2018_06_30.PriceSheets; +import com.microsoft.azure.management.consumption.v2018_06_30.CostTags; +import com.microsoft.azure.management.consumption.v2018_06_30.Tags; +import com.microsoft.azure.management.consumption.v2018_06_30.Forecasts; +import com.microsoft.azure.management.consumption.v2018_06_30.Operations; +import com.microsoft.azure.management.consumption.v2018_06_30.AggregatedCosts; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Consumption resource management. + */ +public final class ConsumptionManager extends ManagerCore { + private UsageDetails usageDetails; + private Marketplaces marketplaces; + private Balances balances; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + private ReservationRecommendations reservationRecommendations; + private Budgets budgets; + private PriceSheets priceSheets; + private CostTags costTags; + private Tags tags; + private Forecasts forecasts; + private Operations operations; + private AggregatedCosts aggregatedCosts; + /** + * Get a Configurable instance that can be used to create ConsumptionManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new ConsumptionManager.ConfigurableImpl(); + } + /** + * Creates an instance of ConsumptionManager that exposes Consumption resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the ConsumptionManager + */ + public static ConsumptionManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new ConsumptionManager(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 ConsumptionManager that exposes Consumption resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the ConsumptionManager + */ + public static ConsumptionManager authenticate(RestClient restClient, String subscriptionId) { + return new ConsumptionManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of ConsumptionManager that exposes Consumption management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Consumption management API entry points that work across subscriptions + */ + ConsumptionManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage Marketplaces. + */ + public Marketplaces marketplaces() { + if (this.marketplaces == null) { + this.marketplaces = new MarketplacesImpl(this); + } + return this.marketplaces; + } + + /** + * @return Entry point to manage Balances. + */ + public Balances balances() { + if (this.balances == null) { + this.balances = new BalancesImpl(this); + } + return this.balances; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage ReservationRecommendations. + */ + public ReservationRecommendations reservationRecommendations() { + if (this.reservationRecommendations == null) { + this.reservationRecommendations = new ReservationRecommendationsImpl(this); + } + return this.reservationRecommendations; + } + + /** + * @return Entry point to manage Budgets. + */ + public Budgets budgets() { + if (this.budgets == null) { + this.budgets = new BudgetsImpl(this); + } + return this.budgets; + } + + /** + * @return Entry point to manage PriceSheets. + */ + public PriceSheets priceSheets() { + if (this.priceSheets == null) { + this.priceSheets = new PriceSheetsImpl(this); + } + return this.priceSheets; + } + + /** + * @return Entry point to manage CostTags. + */ + public CostTags costTags() { + if (this.costTags == null) { + this.costTags = new CostTagsImpl(this); + } + return this.costTags; + } + + /** + * @return Entry point to manage Tags. + */ + public Tags tags() { + if (this.tags == null) { + this.tags = new TagsImpl(this); + } + return this.tags; + } + + /** + * @return Entry point to manage Forecasts. + */ + public Forecasts forecasts() { + if (this.forecasts == null) { + this.forecasts = new ForecastsImpl(this); + } + return this.forecasts; + } + + /** + * @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 AggregatedCosts. + */ + public AggregatedCosts aggregatedCosts() { + if (this.aggregatedCosts == null) { + this.aggregatedCosts = new AggregatedCostsImpl(this); + } + return this.aggregatedCosts; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public ConsumptionManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return ConsumptionManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private ConsumptionManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new ConsumptionManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagImpl.java new file mode 100644 index 0000000000000..4cde885fc17aa --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagImpl.java @@ -0,0 +1,53 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.CostTag; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_06_30.CostTagProperties; + +class CostTagImpl extends WrapperImpl implements CostTag { + private final ConsumptionManager manager; + CostTagImpl(CostTagInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public List costTags() { + return this.inner().costTags(); + } + + @Override + public String eTag() { + return this.inner().eTag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagInner.java new file mode 100644 index 0000000000000..775c010a9e876 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagInner.java @@ -0,0 +1,76 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_06_30.CostTagProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A cost tag resource. + */ +@JsonFlatten +public class CostTagInner extends ProxyResource { + /** + * Cost tags. + */ + @JsonProperty(value = "properties.costTags") + private List costTags; + + /** + * eTag of the resource. To handle concurrent update scenario, this field + * will be used to determine whether the user is updating the latest + * version or not. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * Get cost tags. + * + * @return the costTags value + */ + public List costTags() { + return this.costTags; + } + + /** + * Set cost tags. + * + * @param costTags the costTags value to set + * @return the CostTagInner object itself. + */ + public CostTagInner withCostTags(List costTags) { + this.costTags = costTags; + return this; + } + + /** + * Get eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. + * + * @param eTag the eTag value to set + * @return the CostTagInner object itself. + */ + public CostTagInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagsImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagsImpl.java new file mode 100644 index 0000000000000..80c2c38fe1371 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagsImpl.java @@ -0,0 +1,54 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.CostTags; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_06_30.CostTag; + +class CostTagsImpl extends WrapperImpl implements CostTags { + private final ConsumptionManager manager; + + CostTagsImpl(ConsumptionManager manager) { + super(manager.inner().costTags()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String billingAccountId) { + CostTagsInner client = this.inner(); + return client.getAsync(billingAccountId) + .map(new Func1() { + @Override + public CostTag call(CostTagInner inner) { + return new CostTagImpl(inner, manager()); + } + }); + } + + @Override + public Observable createOrUpdateAsync(String billingAccountId, CostTagInner parameters) { + CostTagsInner client = this.inner(); + return client.createOrUpdateAsync(billingAccountId, parameters) + .map(new Func1() { + @Override + public CostTag call(CostTagInner inner) { + return new CostTagImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagsInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagsInner.java new file mode 100644 index 0000000000000..b2ae260b44fef --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/CostTagsInner.java @@ -0,0 +1,228 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +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 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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CostTags. + */ +public class CostTagsInner { + /** The Retrofit service to perform REST calls. */ + private CostTagsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of CostTagsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CostTagsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(CostTagsService.class); + this.client = client; + } + + /** + * The interface defining all the services for CostTags to be + * used by Retrofit to perform actually REST calls. + */ + interface CostTagsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.CostTags get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costTags") + Observable> get(@Path("billingAccountId") String billingAccountId, @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.consumption.v2018_06_30.CostTags createOrUpdate" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/costTags") + Observable> createOrUpdate(@Path("billingAccountId") String billingAccountId, @Query("api-version") String apiVersion, @Body CostTagInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get cost tags for a billing account. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CostTagInner object if successful. + */ + public CostTagInner get(String billingAccountId) { + return getWithServiceResponseAsync(billingAccountId).toBlocking().single().body(); + } + + /** + * Get cost tags for a billing account. + * + * @param billingAccountId BillingAccount 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 billingAccountId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountId), serviceCallback); + } + + /** + * Get cost tags for a billing account. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CostTagInner object + */ + public Observable getAsync(String billingAccountId) { + return getWithServiceResponseAsync(billingAccountId).map(new Func1, CostTagInner>() { + @Override + public CostTagInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get cost tags for a billing account. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CostTagInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountId) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId 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(billingAccountId, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to create or update cost tags associated with a billing account. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param billingAccountId BillingAccount ID + * @param parameters Parameters supplied to the Create cost tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CostTagInner object if successful. + */ + public CostTagInner createOrUpdate(String billingAccountId, CostTagInner parameters) { + return createOrUpdateWithServiceResponseAsync(billingAccountId, parameters).toBlocking().single().body(); + } + + /** + * The operation to create or update cost tags associated with a billing account. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param billingAccountId BillingAccount ID + * @param parameters Parameters supplied to the Create cost tags operation. + * @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 createOrUpdateAsync(String billingAccountId, CostTagInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(billingAccountId, parameters), serviceCallback); + } + + /** + * The operation to create or update cost tags associated with a billing account. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param billingAccountId BillingAccount ID + * @param parameters Parameters supplied to the Create cost tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CostTagInner object + */ + public Observable createOrUpdateAsync(String billingAccountId, CostTagInner parameters) { + return createOrUpdateWithServiceResponseAsync(billingAccountId, parameters).map(new Func1, CostTagInner>() { + @Override + public CostTagInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to create or update cost tags associated with a billing account. Update operation requires latest eTag to be set in the request mandatorily. You may obtain the latest eTag by performing a get operation. Create operation does not require eTag. + * + * @param billingAccountId BillingAccount ID + * @param parameters Parameters supplied to the Create cost tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CostTagInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String billingAccountId, CostTagInner parameters) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(billingAccountId, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastImpl.java new file mode 100644 index 0000000000000..ae2b3a9f90f7d --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastImpl.java @@ -0,0 +1,87 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.Forecast; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2018_06_30.ChargeType; +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_06_30.ForecastPropertiesConfidenceLevelsItem; +import com.microsoft.azure.management.consumption.v2018_06_30.Grain; +import java.util.Map; + +class ForecastImpl extends WrapperImpl implements Forecast { + private final ConsumptionManager manager; + + ForecastImpl(ForecastInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + + + @Override + public BigDecimal charge() { + return this.inner().charge(); + } + + @Override + public ChargeType chargeType() { + return this.inner().chargeType(); + } + + @Override + public List confidenceLevels() { + return this.inner().confidenceLevels(); + } + + @Override + public String currency() { + return this.inner().currency(); + } + + @Override + public Grain grain() { + return this.inner().grain(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String usageDate() { + return this.inner().usageDate(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastInner.java new file mode 100644 index 0000000000000..d2486ea0c65cd --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastInner.java @@ -0,0 +1,156 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.Grain; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2018_06_30.ChargeType; +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_06_30.ForecastPropertiesConfidenceLevelsItem; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A forecast resource. + */ +@JsonFlatten +public class ForecastInner extends ProxyResource { + /** + * The usage date of the forecast. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private String usageDate; + + /** + * The granularity of forecast. Possible values include: 'Daily', + * 'Monthly', 'Yearly'. + */ + @JsonProperty(value = "properties.grain") + private Grain grain; + + /** + * The amount of charge. + */ + @JsonProperty(value = "properties.charge", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal charge; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The type of the charge. Could be actual or forecast. Possible values + * include: 'Actual', 'Forecast'. + */ + @JsonProperty(value = "properties.chargeType") + private ChargeType chargeType; + + /** + * The details about the forecast confidence levels. This is populated only + * when chargeType is Forecast. + */ + @JsonProperty(value = "properties.confidenceLevels", access = JsonProperty.Access.WRITE_ONLY) + private List confidenceLevels; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the usage date of the forecast. + * + * @return the usageDate value + */ + public String usageDate() { + return this.usageDate; + } + + /** + * Get the granularity of forecast. Possible values include: 'Daily', 'Monthly', 'Yearly'. + * + * @return the grain value + */ + public Grain grain() { + return this.grain; + } + + /** + * Set the granularity of forecast. Possible values include: 'Daily', 'Monthly', 'Yearly'. + * + * @param grain the grain value to set + * @return the ForecastInner object itself. + */ + public ForecastInner withGrain(Grain grain) { + this.grain = grain; + return this; + } + + /** + * Get the amount of charge. + * + * @return the charge value + */ + public BigDecimal charge() { + return this.charge; + } + + /** + * Get the ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get the type of the charge. Could be actual or forecast. Possible values include: 'Actual', 'Forecast'. + * + * @return the chargeType value + */ + public ChargeType chargeType() { + return this.chargeType; + } + + /** + * Set the type of the charge. Could be actual or forecast. Possible values include: 'Actual', 'Forecast'. + * + * @param chargeType the chargeType value to set + * @return the ForecastInner object itself. + */ + public ForecastInner withChargeType(ChargeType chargeType) { + this.chargeType = chargeType; + return this; + } + + /** + * Get the details about the forecast confidence levels. This is populated only when chargeType is Forecast. + * + * @return the confidenceLevels value + */ + public List confidenceLevels() { + return this.confidenceLevels; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastsImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastsImpl.java new file mode 100644 index 0000000000000..c33c8c726f648 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastsImpl.java @@ -0,0 +1,68 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.Forecasts; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.arm.utils.PagedListConverter; +import com.microsoft.azure.management.consumption.v2018_06_30.Forecast; + +class ForecastsImpl extends WrapperImpl implements Forecasts { + private PagedListConverter converter; + private final ConsumptionManager manager; + + ForecastsImpl(ConsumptionManager manager) { + super(manager.inner().forecasts()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(ForecastInner inner) { + return Observable.just((Forecast) wrapModel(inner)); + } + }; + } + + public ConsumptionManager manager() { + return this.manager; + } + + private ForecastImpl wrapModel(ForecastInner inner) { + return new ForecastImpl(inner, manager()); + } + + @Override + public PagedList list() { + ForecastsInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + ForecastsInner 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 Forecast call(ForecastInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastsInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastsInner.java new file mode 100644 index 0000000000000..fe28797a6c2f7 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ForecastsInner.java @@ -0,0 +1,223 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +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 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.Path; +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 Forecasts. + */ +public class ForecastsInner { + /** The Retrofit service to perform REST calls. */ + private ForecastsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ForecastsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ForecastsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ForecastsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Forecasts to be + * used by Retrofit to perform actually REST calls. + */ + interface ForecastsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.Forecasts list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Consumption/forecasts") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @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; + } + }; + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @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); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @return the observable to the List<ForecastInner> 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; + } + }); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @return the observable to the List<ForecastInner> 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."); + } + final String filter = null; + return service.list(this.client.subscriptionId(), filter, 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); + } + } + }); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @param filter May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @return the PagedList object if successful. + */ + public PagedList list(String filter) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync(filter).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @param filter May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(filter), serviceCallback); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @param filter May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @return the observable to the List<ForecastInner> object + */ + public Observable> listAsync(String filter) { + return listWithServiceResponseAsync(filter).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Lists the forecast charges by subscriptionId. + * + * @param filter May be used to filter forecasts by properties/usageDate (Utc time), properties/chargeType or properties/grain. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @return the observable to the List<ForecastInner> object + */ + public Observable>> listWithServiceResponseAsync(String filter) { + 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(), filter, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/IdParsingUtils.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..b5a3b06989430 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/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.consumption.v2018_06_30.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/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ManagementGroupAggregatedCostResultImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ManagementGroupAggregatedCostResultImpl.java new file mode 100644 index 0000000000000..a85f6e822ecd5 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ManagementGroupAggregatedCostResultImpl.java @@ -0,0 +1,79 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.ManagementGroupAggregatedCostResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +class ManagementGroupAggregatedCostResultImpl extends WrapperImpl implements ManagementGroupAggregatedCostResult { + private final ConsumptionManager manager; + ManagementGroupAggregatedCostResultImpl(ManagementGroupAggregatedCostResultInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal azureCharges() { + return this.inner().azureCharges(); + } + + @Override + public String billingPeriodId() { + return this.inner().billingPeriodId(); + } + + @Override + public BigDecimal chargesBilledSeparately() { + return this.inner().chargesBilledSeparately(); + } + + @Override + public List children() { + return this.inner().children(); + } + + @Override + public String currency() { + return this.inner().currency(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal marketplaceCharges() { + return this.inner().marketplaceCharges(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ManagementGroupAggregatedCostResultInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ManagementGroupAggregatedCostResultInner.java new file mode 100644 index 0000000000000..587ded15d2c48 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ManagementGroupAggregatedCostResultInner.java @@ -0,0 +1,140 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A management group aggregated cost resource. + */ +@JsonFlatten +public class ManagementGroupAggregatedCostResultInner extends ProxyResource { + /** + * The id of the billing period resource that the aggregated cost belongs + * to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * Azure Charges. + */ + @JsonProperty(value = "properties.azureCharges", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal azureCharges; + + /** + * Marketplace Charges. + */ + @JsonProperty(value = "properties.marketplaceCharges", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal marketplaceCharges; + + /** + * Charges Billed Separately. + */ + @JsonProperty(value = "properties.chargesBilledSeparately", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal chargesBilledSeparately; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * Children of a management group. + */ + @JsonProperty(value = "properties.children") + private List children; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the id of the billing period resource that the aggregated cost belongs to. + * + * @return the billingPeriodId value + */ + public String billingPeriodId() { + return this.billingPeriodId; + } + + /** + * Get azure Charges. + * + * @return the azureCharges value + */ + public BigDecimal azureCharges() { + return this.azureCharges; + } + + /** + * Get marketplace Charges. + * + * @return the marketplaceCharges value + */ + public BigDecimal marketplaceCharges() { + return this.marketplaceCharges; + } + + /** + * Get charges Billed Separately. + * + * @return the chargesBilledSeparately value + */ + public BigDecimal chargesBilledSeparately() { + return this.chargesBilledSeparately; + } + + /** + * Get the ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get children of a management group. + * + * @return the children value + */ + public List children() { + return this.children; + } + + /** + * Set children of a management group. + * + * @param children the children value to set + * @return the ManagementGroupAggregatedCostResultInner object itself. + */ + public ManagementGroupAggregatedCostResultInner withChildren(List children) { + this.children = children; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplaceImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplaceImpl.java new file mode 100644 index 0000000000000..cb58cd8505bd9 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplaceImpl.java @@ -0,0 +1,170 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.Marketplace; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.UUID; +import java.util.Map; +import org.joda.time.DateTime; + +class MarketplaceImpl extends WrapperImpl implements Marketplace { + private final ConsumptionManager manager; + MarketplaceImpl(MarketplaceInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String accountName() { + return this.inner().accountName(); + } + + @Override + public String additionalProperties() { + return this.inner().additionalProperties(); + } + + @Override + public String billingPeriodId() { + return this.inner().billingPeriodId(); + } + + @Override + public BigDecimal consumedQuantity() { + return this.inner().consumedQuantity(); + } + + @Override + public String consumedService() { + return this.inner().consumedService(); + } + + @Override + public String costCenter() { + return this.inner().costCenter(); + } + + @Override + public String currency() { + return this.inner().currency(); + } + + @Override + public String departmentName() { + return this.inner().departmentName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String instanceName() { + return this.inner().instanceName(); + } + + @Override + public Boolean isEstimated() { + return this.inner().isEstimated(); + } + + @Override + public UUID meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String offerName() { + return this.inner().offerName(); + } + + @Override + public String orderNumber() { + return this.inner().orderNumber(); + } + + @Override + public String planName() { + return this.inner().planName(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String publisherName() { + return this.inner().publisherName(); + } + + @Override + public String resourceGroup() { + return this.inner().resourceGroup(); + } + + @Override + public BigDecimal resourceRate() { + return this.inner().resourceRate(); + } + + @Override + public UUID subscriptionGuid() { + return this.inner().subscriptionGuid(); + } + + @Override + public String subscriptionName() { + return this.inner().subscriptionName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String unitOfMeasure() { + return this.inner().unitOfMeasure(); + } + + @Override + public DateTime usageEnd() { + return this.inner().usageEnd(); + } + + @Override + public DateTime usageStart() { + return this.inner().usageStart(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplaceInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplaceInner.java new file mode 100644 index 0000000000000..08287336920cc --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplaceInner.java @@ -0,0 +1,401 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import java.util.UUID; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An marketplace resource. + */ +@JsonFlatten +public class MarketplaceInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The marketplace resource rate. + */ + @JsonProperty(value = "properties.resourceRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal resourceRate; + + /** + * The type of offer. + */ + @JsonProperty(value = "properties.offerName", access = JsonProperty.Access.WRITE_ONLY) + private String offerName; + + /** + * The name of resource group. + */ + @JsonProperty(value = "properties.resourceGroup", access = JsonProperty.Access.WRITE_ONLY) + private String resourceGroup; + + /** + * The order number. + */ + @JsonProperty(value = "properties.orderNumber", access = JsonProperty.Access.WRITE_ONLY) + private String orderNumber; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.consumedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal consumedQuantity; + + /** + * The unit of measure. + */ + @JsonProperty(value = "properties.unitOfMeasure", access = JsonProperty.Access.WRITE_ONLY) + private String unitOfMeasure; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id (GUID). + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private UUID meterId; + + /** + * Subscription guid. + */ + @JsonProperty(value = "properties.subscriptionGuid", access = JsonProperty.Access.WRITE_ONLY) + private UUID subscriptionGuid; + + /** + * Subscription name. + */ + @JsonProperty(value = "properties.subscriptionName", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionName; + + /** + * Account name. + */ + @JsonProperty(value = "properties.accountName", access = JsonProperty.Access.WRITE_ONLY) + private String accountName; + + /** + * Department name. + */ + @JsonProperty(value = "properties.departmentName", access = JsonProperty.Access.WRITE_ONLY) + private String departmentName; + + /** + * Consumed service name. + */ + @JsonProperty(value = "properties.consumedService", access = JsonProperty.Access.WRITE_ONLY) + private String consumedService; + + /** + * The cost center of this department if it is a department and a + * costcenter exists. + */ + @JsonProperty(value = "properties.costCenter", access = JsonProperty.Access.WRITE_ONLY) + private String costCenter; + + /** + * Additional details of this usage item. By default this is not populated, + * unless it's specified in $expand. + */ + @JsonProperty(value = "properties.additionalProperties", access = JsonProperty.Access.WRITE_ONLY) + private String additionalProperties; + + /** + * The name of publisher. + */ + @JsonProperty(value = "properties.publisherName", access = JsonProperty.Access.WRITE_ONLY) + private String publisherName; + + /** + * The name of plan. + */ + @JsonProperty(value = "properties.planName", access = JsonProperty.Access.WRITE_ONLY) + private String planName; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the id of the billing period resource that the usage belongs to. + * + * @return the billingPeriodId value + */ + public String billingPeriodId() { + return this.billingPeriodId; + } + + /** + * Get the start of the date time range covered by the usage detail. + * + * @return the usageStart value + */ + public DateTime usageStart() { + return this.usageStart; + } + + /** + * Get the end of the date time range covered by the usage detail. + * + * @return the usageEnd value + */ + public DateTime usageEnd() { + return this.usageEnd; + } + + /** + * Get the marketplace resource rate. + * + * @return the resourceRate value + */ + public BigDecimal resourceRate() { + return this.resourceRate; + } + + /** + * Get the type of offer. + * + * @return the offerName value + */ + public String offerName() { + return this.offerName; + } + + /** + * Get the name of resource group. + * + * @return the resourceGroup value + */ + public String resourceGroup() { + return this.resourceGroup; + } + + /** + * Get the order number. + * + * @return the orderNumber value + */ + public String orderNumber() { + return this.orderNumber; + } + + /** + * Get the name of the resource instance that the usage is about. + * + * @return the instanceName value + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Get the uri of the resource instance that the usage is about. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get the ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get the quantity of usage. + * + * @return the consumedQuantity value + */ + public BigDecimal consumedQuantity() { + return this.consumedQuantity; + } + + /** + * Get the unit of measure. + * + * @return the unitOfMeasure value + */ + public String unitOfMeasure() { + return this.unitOfMeasure; + } + + /** + * Get the amount of cost before tax. + * + * @return the pretaxCost value + */ + public BigDecimal pretaxCost() { + return this.pretaxCost; + } + + /** + * Get the estimated usage is subject to change. + * + * @return the isEstimated value + */ + public Boolean isEstimated() { + return this.isEstimated; + } + + /** + * Get the meter id (GUID). + * + * @return the meterId value + */ + public UUID meterId() { + return this.meterId; + } + + /** + * Get subscription guid. + * + * @return the subscriptionGuid value + */ + public UUID subscriptionGuid() { + return this.subscriptionGuid; + } + + /** + * Get subscription name. + * + * @return the subscriptionName value + */ + public String subscriptionName() { + return this.subscriptionName; + } + + /** + * Get account name. + * + * @return the accountName value + */ + public String accountName() { + return this.accountName; + } + + /** + * Get department name. + * + * @return the departmentName value + */ + public String departmentName() { + return this.departmentName; + } + + /** + * Get consumed service name. + * + * @return the consumedService value + */ + public String consumedService() { + return this.consumedService; + } + + /** + * Get the cost center of this department if it is a department and a costcenter exists. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Get additional details of this usage item. By default this is not populated, unless it's specified in $expand. + * + * @return the additionalProperties value + */ + public String additionalProperties() { + return this.additionalProperties; + } + + /** + * Get the name of publisher. + * + * @return the publisherName value + */ + public String publisherName() { + return this.publisherName; + } + + /** + * Get the name of plan. + * + * @return the planName value + */ + public String planName() { + return this.planName; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplacesImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplacesImpl.java new file mode 100644 index 0000000000000..b58ba9e799874 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplacesImpl.java @@ -0,0 +1,175 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.Marketplaces; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2018_06_30.Marketplace; + +class MarketplacesImpl extends WrapperImpl implements Marketplaces { + private final ConsumptionManager manager; + + MarketplacesImpl(ConsumptionManager manager) { + super(manager.inner().marketplaces()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listByBillingPeriodAsync(final String billingPeriodName) { + MarketplacesInner client = this.inner(); + return client.listByBillingPeriodAsync(billingPeriodName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Marketplace call(MarketplaceInner inner) { + return new MarketplaceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountId) { + MarketplacesInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Marketplace call(MarketplaceInner inner) { + return new MarketplaceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName) { + MarketplacesInner client = this.inner(); + return client.listForBillingPeriodByBillingAccountAsync(billingAccountId, billingPeriodName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Marketplace call(MarketplaceInner inner) { + return new MarketplaceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByDepartmentAsync(final String departmentId) { + MarketplacesInner client = this.inner(); + return client.listByDepartmentAsync(departmentId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Marketplace call(MarketplaceInner inner) { + return new MarketplaceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName) { + MarketplacesInner client = this.inner(); + return client.listForBillingPeriodByDepartmentAsync(departmentId, billingPeriodName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Marketplace call(MarketplaceInner inner) { + return new MarketplaceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByEnrollmentAccountAsync(final String enrollmentAccountId) { + MarketplacesInner client = this.inner(); + return client.listByEnrollmentAccountAsync(enrollmentAccountId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Marketplace call(MarketplaceInner inner) { + return new MarketplaceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName) { + MarketplacesInner client = this.inner(); + return client.listForBillingPeriodByEnrollmentAccountAsync(enrollmentAccountId, billingPeriodName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Marketplace call(MarketplaceInner inner) { + return new MarketplaceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + MarketplacesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Marketplace call(MarketplaceInner inner) { + return new MarketplaceImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplacesInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplacesInner.java new file mode 100644 index 0000000000000..8b75738a09aee --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/MarketplacesInner.java @@ -0,0 +1,2937 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +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.Path; +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 Marketplaces. + */ +public class MarketplacesInner { + /** The Retrofit service to perform REST calls. */ + private MarketplacesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of MarketplacesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MarketplacesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(MarketplacesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Marketplaces to be + * used by Retrofit to perform actually REST calls. + */ + interface MarketplacesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.Marketplaces list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Consumption/marketplaces") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skiptoken") String skiptoken, @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.consumption.v2018_06_30.Marketplaces listByBillingPeriod" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces") + Observable> listByBillingPeriod(@Path("subscriptionId") String subscriptionId, @Path("billingPeriodName") String billingPeriodName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skiptoken") String skiptoken, @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.consumption.v2018_06_30.Marketplaces listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/marketplaces") + Observable> listByBillingAccount(@Path("billingAccountId") String billingAccountId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skiptoken") String skiptoken, @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.consumption.v2018_06_30.Marketplaces listForBillingPeriodByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces") + Observable> listForBillingPeriodByBillingAccount(@Path("billingAccountId") String billingAccountId, @Path("billingPeriodName") String billingPeriodName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skiptoken") String skiptoken, @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.consumption.v2018_06_30.Marketplaces listByDepartment" }) + @GET("providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Consumption/marketplaces") + Observable> listByDepartment(@Path("departmentId") String departmentId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skiptoken") String skiptoken, @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.consumption.v2018_06_30.Marketplaces listForBillingPeriodByDepartment" }) + @GET("providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces") + Observable> listForBillingPeriodByDepartment(@Path("departmentId") String departmentId, @Path("billingPeriodName") String billingPeriodName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skiptoken") String skiptoken, @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.consumption.v2018_06_30.Marketplaces listByEnrollmentAccount" }) + @GET("providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Consumption/marketplaces") + Observable> listByEnrollmentAccount(@Path("enrollmentAccountId") String enrollmentAccountId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skiptoken") String skiptoken, @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.consumption.v2018_06_30.Marketplaces listForBillingPeriodByEnrollmentAccount" }) + @GET("providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/marketplaces") + Observable> listForBillingPeriodByEnrollmentAccount(@Path("enrollmentAccountId") String enrollmentAccountId, @Path("billingPeriodName") String billingPeriodName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$skiptoken") String skiptoken, @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.consumption.v2018_06_30.Marketplaces listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @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.consumption.v2018_06_30.Marketplaces listByBillingPeriodNext" }) + @GET + Observable> listByBillingPeriodNext(@Url String nextUrl, @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.consumption.v2018_06_30.Marketplaces listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @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.consumption.v2018_06_30.Marketplaces listForBillingPeriodByBillingAccountNext" }) + @GET + Observable> listForBillingPeriodByBillingAccountNext(@Url String nextUrl, @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.consumption.v2018_06_30.Marketplaces listByDepartmentNext" }) + @GET + Observable> listByDepartmentNext(@Url String nextUrl, @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.consumption.v2018_06_30.Marketplaces listForBillingPeriodByDepartmentNext" }) + @GET + Observable> listForBillingPeriodByDepartmentNext(@Url String nextUrl, @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.consumption.v2018_06_30.Marketplaces listByEnrollmentAccountNext" }) + @GET + Observable> listByEnrollmentAccountNext(@Url String nextUrl, @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.consumption.v2018_06_30.Marketplaces listForBillingPeriodByEnrollmentAccountNext" }) + @GET + Observable> listForBillingPeriodByEnrollmentAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> 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 the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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 the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> 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 the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> 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(), filter, top, skiptoken, 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); + } + } + }); + } + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> 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(); + } + }; + } + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent 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> 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); + } + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> 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(); + } + }); + } + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> 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)); + } + }); + } + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N marketplaces. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> 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(), filter, top, skiptoken, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByBillingPeriod(final String billingPeriodName) { + ServiceResponse> response = listByBillingPeriodSinglePageAsync(billingPeriodName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @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> listByBillingPeriodAsync(final String billingPeriodName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingPeriodSinglePageAsync(billingPeriodName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listByBillingPeriodAsync(final String billingPeriodName) { + return listByBillingPeriodWithServiceResponseAsync(billingPeriodName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listByBillingPeriodWithServiceResponseAsync(final String billingPeriodName) { + return listByBillingPeriodSinglePageAsync(billingPeriodName) + .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(listByBillingPeriodNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingPeriodSinglePageAsync(final String billingPeriodName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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.listByBillingPeriod(this.client.subscriptionId(), billingPeriodName, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingPeriodDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByBillingPeriod(final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + ServiceResponse> response = listByBillingPeriodSinglePageAsync(billingPeriodName, filter, top, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent 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> listByBillingPeriodAsync(final String billingPeriodName, final String filter, final Integer top, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingPeriodSinglePageAsync(billingPeriodName, filter, top, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listByBillingPeriodAsync(final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + return listByBillingPeriodWithServiceResponseAsync(billingPeriodName, filter, top, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listByBillingPeriodWithServiceResponseAsync(final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + return listByBillingPeriodSinglePageAsync(billingPeriodName, 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(listByBillingPeriodNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param billingPeriodName Billing Period Name. + ServiceResponse> * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N marketplaces. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingPeriodSinglePageAsync(final String billingPeriodName, 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 (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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.listByBillingPeriod(this.client.subscriptionId(), billingPeriodName, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingPeriodDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingPeriodDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountId) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount 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> listByBillingAccountAsync(final String billingAccountId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountId) { + return listByBillingAccountWithServiceResponseAsync(billingAccountId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountId) { + return listByBillingAccountSinglePageAsync(billingAccountId) + .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(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountId) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId 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.listByBillingAccount(billingAccountId, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountId, final String filter, final Integer top, final String skiptoken) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountId, filter, top, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent 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> listByBillingAccountAsync(final String billingAccountId, final String filter, final Integer top, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountId, filter, top, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountId, final String filter, final Integer top, final String skiptoken) { + return listByBillingAccountWithServiceResponseAsync(billingAccountId, filter, top, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountId, final String filter, final Integer top, final String skiptoken) { + return listByBillingAccountSinglePageAsync(billingAccountId, 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(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param billingAccountId BillingAccount ID + ServiceResponse> * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N marketplaces. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountId, final String filter, final Integer top, final String skiptoken) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId 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.listByBillingAccount(billingAccountId, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listForBillingPeriodByBillingAccount(final String billingAccountId, final String billingPeriodName) { + ServiceResponse> response = listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @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> listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName) { + return listForBillingPeriodByBillingAccountWithServiceResponseAsync(billingAccountId, billingPeriodName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listForBillingPeriodByBillingAccountWithServiceResponseAsync(final String billingAccountId, final String billingPeriodName) { + return listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName) + .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(listForBillingPeriodByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByBillingAccountSinglePageAsync(final String billingAccountId, final String billingPeriodName) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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.listForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listForBillingPeriodByBillingAccount(final String billingAccountId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + ServiceResponse> response = listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName, filter, top, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent 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> listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName, filter, top, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + return listForBillingPeriodByBillingAccountWithServiceResponseAsync(billingAccountId, billingPeriodName, filter, top, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listForBillingPeriodByBillingAccountWithServiceResponseAsync(final String billingAccountId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + return listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName, 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(listForBillingPeriodByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param billingAccountId BillingAccount ID + ServiceResponse> * @param billingPeriodName Billing Period Name. + ServiceResponse> * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N marketplaces. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByBillingAccountSinglePageAsync(final String billingAccountId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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.listForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByDepartment(final String departmentId) { + ServiceResponse> response = listByDepartmentSinglePageAsync(departmentId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department 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> listByDepartmentAsync(final String departmentId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentSinglePageAsync(departmentId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listByDepartmentAsync(final String departmentId) { + return listByDepartmentWithServiceResponseAsync(departmentId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listByDepartmentWithServiceResponseAsync(final String departmentId) { + return listByDepartmentSinglePageAsync(departmentId) + .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(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentSinglePageAsync(final String departmentId) { + if (departmentId == null) { + throw new IllegalArgumentException("Parameter departmentId 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.listByDepartment(departmentId, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByDepartment(final String departmentId, final String filter, final Integer top, final String skiptoken) { + ServiceResponse> response = listByDepartmentSinglePageAsync(departmentId, filter, top, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent 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> listByDepartmentAsync(final String departmentId, final String filter, final Integer top, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentSinglePageAsync(departmentId, filter, top, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listByDepartmentAsync(final String departmentId, final String filter, final Integer top, final String skiptoken) { + return listByDepartmentWithServiceResponseAsync(departmentId, filter, top, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listByDepartmentWithServiceResponseAsync(final String departmentId, final String filter, final Integer top, final String skiptoken) { + return listByDepartmentSinglePageAsync(departmentId, 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(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param departmentId Department ID + ServiceResponse> * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N marketplaces. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentSinglePageAsync(final String departmentId, final String filter, final Integer top, final String skiptoken) { + if (departmentId == null) { + throw new IllegalArgumentException("Parameter departmentId 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.listByDepartment(departmentId, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDepartmentDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listForBillingPeriodByDepartment(final String departmentId, final String billingPeriodName) { + ServiceResponse> response = listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @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> listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName) { + return listForBillingPeriodByDepartmentWithServiceResponseAsync(departmentId, billingPeriodName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listForBillingPeriodByDepartmentWithServiceResponseAsync(final String departmentId, final String billingPeriodName) { + return listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName) + .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(listForBillingPeriodByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByDepartmentSinglePageAsync(final String departmentId, final String billingPeriodName) { + if (departmentId == null) { + throw new IllegalArgumentException("Parameter departmentId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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.listForBillingPeriodByDepartment(departmentId, billingPeriodName, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByDepartmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listForBillingPeriodByDepartment(final String departmentId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + ServiceResponse> response = listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName, filter, top, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent 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> listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName, filter, top, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + return listForBillingPeriodByDepartmentWithServiceResponseAsync(departmentId, billingPeriodName, filter, top, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listForBillingPeriodByDepartmentWithServiceResponseAsync(final String departmentId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + return listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName, 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(listForBillingPeriodByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param departmentId Department ID + ServiceResponse> * @param billingPeriodName Billing Period Name. + ServiceResponse> * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N marketplaces. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByDepartmentSinglePageAsync(final String departmentId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + if (departmentId == null) { + throw new IllegalArgumentException("Parameter departmentId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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.listForBillingPeriodByDepartment(departmentId, billingPeriodName, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByDepartmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByDepartmentDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByEnrollmentAccount(final String enrollmentAccountId) { + ServiceResponse> response = listByEnrollmentAccountSinglePageAsync(enrollmentAccountId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount 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> listByEnrollmentAccountAsync(final String enrollmentAccountId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountSinglePageAsync(enrollmentAccountId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listByEnrollmentAccountAsync(final String enrollmentAccountId) { + return listByEnrollmentAccountWithServiceResponseAsync(enrollmentAccountId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listByEnrollmentAccountWithServiceResponseAsync(final String enrollmentAccountId) { + return listByEnrollmentAccountSinglePageAsync(enrollmentAccountId) + .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(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountSinglePageAsync(final String enrollmentAccountId) { + if (enrollmentAccountId == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountId 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.listByEnrollmentAccount(enrollmentAccountId, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByEnrollmentAccount(final String enrollmentAccountId, final String filter, final Integer top, final String skiptoken) { + ServiceResponse> response = listByEnrollmentAccountSinglePageAsync(enrollmentAccountId, filter, top, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent 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> listByEnrollmentAccountAsync(final String enrollmentAccountId, final String filter, final Integer top, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountSinglePageAsync(enrollmentAccountId, filter, top, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listByEnrollmentAccountAsync(final String enrollmentAccountId, final String filter, final Integer top, final String skiptoken) { + return listByEnrollmentAccountWithServiceResponseAsync(enrollmentAccountId, filter, top, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listByEnrollmentAccountWithServiceResponseAsync(final String enrollmentAccountId, final String filter, final Integer top, final String skiptoken) { + return listByEnrollmentAccountSinglePageAsync(enrollmentAccountId, 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(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param enrollmentAccountId EnrollmentAccount ID + ServiceResponse> * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N marketplaces. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountSinglePageAsync(final String enrollmentAccountId, final String filter, final Integer top, final String skiptoken) { + if (enrollmentAccountId == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountId 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.listByEnrollmentAccount(enrollmentAccountId, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEnrollmentAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listForBillingPeriodByEnrollmentAccount(final String enrollmentAccountId, final String billingPeriodName) { + ServiceResponse> response = listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @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> listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName) { + return listForBillingPeriodByEnrollmentAccountWithServiceResponseAsync(enrollmentAccountId, billingPeriodName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listForBillingPeriodByEnrollmentAccountWithServiceResponseAsync(final String enrollmentAccountId, final String billingPeriodName) { + return listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName) + .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(listForBillingPeriodByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByEnrollmentAccountSinglePageAsync(final String enrollmentAccountId, final String billingPeriodName) { + if (enrollmentAccountId == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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.listForBillingPeriodByEnrollmentAccount(enrollmentAccountId, billingPeriodName, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByEnrollmentAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listForBillingPeriodByEnrollmentAccount(final String enrollmentAccountId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + ServiceResponse> response = listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName, filter, top, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent 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> listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName, filter, top, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable> listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + return listForBillingPeriodByEnrollmentAccountWithServiceResponseAsync(enrollmentAccountId, billingPeriodName, filter, top, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @param top May be used to limit the number of results to the most recent N marketplaces. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MarketplaceInner> object + */ + public Observable>> listForBillingPeriodByEnrollmentAccountWithServiceResponseAsync(final String enrollmentAccountId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + return listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName, 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(listForBillingPeriodByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param enrollmentAccountId EnrollmentAccount ID + ServiceResponse> * @param billingPeriodName Billing Period Name. + ServiceResponse> * @param filter May be used to filter marketplaces by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N marketplaces. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByEnrollmentAccountSinglePageAsync(final String enrollmentAccountId, final String billingPeriodName, final String filter, final Integer top, final String skiptoken) { + if (enrollmentAccountId == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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.listForBillingPeriodByEnrollmentAccount(enrollmentAccountId, billingPeriodName, filter, top, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByEnrollmentAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByEnrollmentAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> 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 the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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 the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> 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 the marketplaces for a scope by subscriptionId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByBillingPeriodNext(final String nextPageLink) { + ServiceResponse> response = listByBillingPeriodNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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> listByBillingPeriodNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingPeriodNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable> listByBillingPeriodNextAsync(final String nextPageLink) { + return listByBillingPeriodNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable>> listByBillingPeriodNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(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(listByBillingPeriodNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and subscriptionId. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingPeriodNextSinglePageAsync(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.listByBillingPeriodNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingPeriodNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingPeriodNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(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(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billingAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(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.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listForBillingPeriodByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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> listForBillingPeriodByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable> listForBillingPeriodByBillingAccountNextAsync(final String nextPageLink) { + return listForBillingPeriodByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable>> listForBillingPeriodByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(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(listForBillingPeriodByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and billingAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByBillingAccountNextSinglePageAsync(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.listForBillingPeriodByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByDepartmentNext(final String nextPageLink) { + ServiceResponse> response = listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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> listByDepartmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable> listByDepartmentNextAsync(final String nextPageLink) { + return listByDepartmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable>> listByDepartmentNextWithServiceResponseAsync(final String nextPageLink) { + return listByDepartmentNextSinglePageAsync(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(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by departmentId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentNextSinglePageAsync(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.listByDepartmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDepartmentNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listForBillingPeriodByDepartmentNext(final String nextPageLink) { + ServiceResponse> response = listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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> listForBillingPeriodByDepartmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable> listForBillingPeriodByDepartmentNextAsync(final String nextPageLink) { + return listForBillingPeriodByDepartmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable>> listForBillingPeriodByDepartmentNextWithServiceResponseAsync(final String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(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(listForBillingPeriodByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and departmentId. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByDepartmentNextSinglePageAsync(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.listForBillingPeriodByDepartmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByDepartmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByDepartmentNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listByEnrollmentAccountNext(final String nextPageLink) { + ServiceResponse> response = listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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> listByEnrollmentAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable> listByEnrollmentAccountNextAsync(final String nextPageLink) { + return listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable>> listByEnrollmentAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(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(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by enrollmentAccountId and current billing period. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountNextSinglePageAsync(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.listByEnrollmentAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEnrollmentAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MarketplaceInner> object if successful. + */ + public PagedList listForBillingPeriodByEnrollmentAccountNext(final String nextPageLink) { + ServiceResponse> response = listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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> listForBillingPeriodByEnrollmentAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable> listForBillingPeriodByEnrollmentAccountNextAsync(final String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + * @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<MarketplaceInner> object + */ + public Observable>> listForBillingPeriodByEnrollmentAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(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(listForBillingPeriodByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the marketplaces for a scope by billing period and enrollmentAccountId. Marketplaces are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MarketplaceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(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.listForBillingPeriodByEnrollmentAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByEnrollmentAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByEnrollmentAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationImpl.java new file mode 100644 index 0000000000000..3edbe9210b9f9 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationImpl.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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationInner.java new file mode 100644 index 0000000000000..959e299dde74b --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationsImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..da9c6b9791242 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2018_06_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager 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 Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationsInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/OperationsInner.java new file mode 100644 index 0000000000000..970f86a5b1d36 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +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 ConsumptionManagementClientImpl 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, ConsumptionManagementClientImpl 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.consumption.v2018_06_30.Operations list" }) + @GET("providers/Microsoft.Consumption/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.consumption.v2018_06_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<OperationInner> 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 of the available consumption 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 of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> 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 of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<OperationInner> 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 of the available consumption 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 of the available consumption 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<OperationInner> 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 of the available consumption 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<OperationInner> 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 of the available consumption 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<OperationInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PageImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PageImpl.java new file mode 100644 index 0000000000000..3c860431f8c7b --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/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.consumption.v2018_06_30.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/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PageImpl1.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PageImpl1.java new file mode 100644 index 0000000000000..553956ecba34b --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/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.consumption.v2018_06_30.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/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetResultImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetResultImpl.java new file mode 100644 index 0000000000000..d8301d8c7e559 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetResultImpl.java @@ -0,0 +1,59 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.PriceSheetResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_06_30.PriceSheetProperties; +import java.util.Map; + +class PriceSheetResultImpl extends WrapperImpl implements PriceSheetResult { + private final ConsumptionManager manager; + PriceSheetResultImpl(PriceSheetResultInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List pricesheets() { + return this.inner().pricesheets(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetResultInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetResultInner.java new file mode 100644 index 0000000000000..d2847d06df34d --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetResultInner.java @@ -0,0 +1,68 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_06_30.PriceSheetProperties; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An pricesheet resource. + */ +@JsonFlatten +public class PriceSheetResultInner extends ProxyResource { + /** + * Price sheet. + */ + @JsonProperty(value = "properties.pricesheets", access = JsonProperty.Access.WRITE_ONLY) + private List pricesheets; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "properties.nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get price sheet. + * + * @return the pricesheets value + */ + public List pricesheets() { + return this.pricesheets; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetsImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetsImpl.java new file mode 100644 index 0000000000000..94f5635fbe36d --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetsImpl.java @@ -0,0 +1,54 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.PriceSheets; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_06_30.PriceSheetResult; + +class PriceSheetsImpl extends WrapperImpl implements PriceSheets { + private final ConsumptionManager manager; + + PriceSheetsImpl(ConsumptionManager manager) { + super(manager.inner().priceSheets()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable getAsync() { + PriceSheetsInner client = this.inner(); + return client.getAsync() + .map(new Func1() { + @Override + public PriceSheetResult call(PriceSheetResultInner inner) { + return new PriceSheetResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByBillingPeriodAsync(String billingPeriodName) { + PriceSheetsInner client = this.inner(); + return client.getByBillingPeriodAsync(billingPeriodName) + .map(new Func1() { + @Override + public PriceSheetResult call(PriceSheetResultInner inner) { + return new PriceSheetResultImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetsInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetsInner.java new file mode 100644 index 0000000000000..a90a4ccbd45d9 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/PriceSheetsInner.java @@ -0,0 +1,382 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 PriceSheets. + */ +public class PriceSheetsInner { + /** The Retrofit service to perform REST calls. */ + private PriceSheetsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of PriceSheetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PriceSheetsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(PriceSheetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PriceSheets to be + * used by Retrofit to perform actually REST calls. + */ + interface PriceSheetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.PriceSheets get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Consumption/pricesheets/default") + Observable> get(@Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @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.consumption.v2018_06_30.PriceSheets getByBillingPeriod" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/pricesheets/default") + Observable> getByBillingPeriod(@Path("subscriptionId") String subscriptionId, @Path("billingPeriodName") String billingPeriodName, @Query("$expand") String expand, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PriceSheetResultInner object if successful. + */ + public PriceSheetResultInner get() { + return getWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or later. + * + * @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(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PriceSheetResultInner object + */ + public Observable getAsync() { + return getWithServiceResponseAsync().map(new Func1, PriceSheetResultInner>() { + @Override + public PriceSheetResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PriceSheetResultInner object + */ + public Observable> getWithServiceResponseAsync() { + 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 expand = null; + final String skiptoken = null; + final Integer top = null; + return service.get(this.client.subscriptionId(), expand, skiptoken, top, 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); + } + } + }); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PriceSheetResultInner object if successful. + */ + public PriceSheetResultInner get(String expand, String skiptoken, Integer top) { + return getWithServiceResponseAsync(expand, skiptoken, top).toBlocking().single().body(); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 expand, String skiptoken, Integer top, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(expand, skiptoken, top), serviceCallback); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PriceSheetResultInner object + */ + public Observable getAsync(String expand, String skiptoken, Integer top) { + return getWithServiceResponseAsync(expand, skiptoken, top).map(new Func1, PriceSheetResultInner>() { + @Override + public PriceSheetResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the price sheet for a scope by subscriptionId. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PriceSheetResultInner object + */ + public Observable> getWithServiceResponseAsync(String expand, String skiptoken, Integer top) { + 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.get(this.client.subscriptionId(), expand, skiptoken, top, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PriceSheetResultInner object if successful. + */ + public PriceSheetResultInner getByBillingPeriod(String billingPeriodName) { + return getByBillingPeriodWithServiceResponseAsync(billingPeriodName).toBlocking().single().body(); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @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 getByBillingPeriodAsync(String billingPeriodName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingPeriodWithServiceResponseAsync(billingPeriodName), serviceCallback); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PriceSheetResultInner object + */ + public Observable getByBillingPeriodAsync(String billingPeriodName) { + return getByBillingPeriodWithServiceResponseAsync(billingPeriodName).map(new Func1, PriceSheetResultInner>() { + @Override + public PriceSheetResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PriceSheetResultInner object + */ + public Observable> getByBillingPeriodWithServiceResponseAsync(String billingPeriodName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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 expand = null; + final String skiptoken = null; + final Integer top = null; + return service.getByBillingPeriod(this.client.subscriptionId(), billingPeriodName, expand, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingPeriodDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PriceSheetResultInner object if successful. + */ + public PriceSheetResultInner getByBillingPeriod(String billingPeriodName, String expand, String skiptoken, Integer top) { + return getByBillingPeriodWithServiceResponseAsync(billingPeriodName, expand, skiptoken, top).toBlocking().single().body(); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @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 getByBillingPeriodAsync(String billingPeriodName, String expand, String skiptoken, Integer top, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingPeriodWithServiceResponseAsync(billingPeriodName, expand, skiptoken, top), serviceCallback); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PriceSheetResultInner object + */ + public Observable getByBillingPeriodAsync(String billingPeriodName, String expand, String skiptoken, Integer top) { + return getByBillingPeriodWithServiceResponseAsync(billingPeriodName, expand, skiptoken, top).map(new Func1, PriceSheetResultInner>() { + @Override + public PriceSheetResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the price sheet for a scope by subscriptionId and billing period. Price sheet is available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/meterDetails within a price sheet. By default, these fields are not included when returning price sheet. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the top N results. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PriceSheetResultInner object + */ + public Observable> getByBillingPeriodWithServiceResponseAsync(String billingPeriodName, String expand, String skiptoken, Integer top) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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.getByBillingPeriod(this.client.subscriptionId(), billingPeriodName, expand, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingPeriodDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingPeriodDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationDetailImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationDetailImpl.java new file mode 100644 index 0000000000000..41ed82988f941 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationDetailImpl.java @@ -0,0 +1,89 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailImpl extends WrapperImpl implements ReservationDetail { + private final ConsumptionManager manager; + ReservationDetailImpl(ReservationDetailInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationDetailInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationDetailInner.java new file mode 100644 index 0000000000000..6389daa1825ba --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationDetailInner.java @@ -0,0 +1,169 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation detail resource. + */ +@JsonFlatten +public class ReservationDetailInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationImpl.java new file mode 100644 index 0000000000000..ab6500f820c31 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationImpl.java @@ -0,0 +1,93 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationRecommendation; +import rx.Observable; +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.UUID; + +class ReservationRecommendationImpl extends GroupableResourceCoreImpl implements ReservationRecommendation { + ReservationRecommendationImpl(String name, ReservationRecommendationInner inner, ConsumptionManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + ReservationRecommendationsInner client = this.manager().inner().reservationRecommendations(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + ReservationRecommendationsInner client = this.manager().inner().reservationRecommendations(); + return null; // NOP updateResourceAsync implementation as update is not supported + } + + @Override + protected Observable getInnerAsync() { + ReservationRecommendationsInner client = this.manager().inner().reservationRecommendations(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + + + @Override + public BigDecimal costWithNoReservedInstances() { + return this.inner().costWithNoReservedInstances(); + } + + @Override + public DateTime firstUsageDate() { + return this.inner().firstUsageDate(); + } + + @Override + public String lookBackPeriod() { + return this.inner().lookBackPeriod(); + } + + @Override + public UUID meterId() { + return this.inner().meterId(); + } + + @Override + public BigDecimal netSavings() { + return this.inner().netSavings(); + } + + @Override + public BigDecimal recommendedQuantity() { + return this.inner().recommendedQuantity(); + } + + @Override + public String scope() { + return this.inner().scope(); + } + + @Override + public String sku() { + return this.inner().sku(); + } + + @Override + public String term() { + return this.inner().term(); + } + + @Override + public BigDecimal totalCostWithReservedInstances() { + return this.inner().totalCostWithReservedInstances(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationInner.java new file mode 100644 index 0000000000000..dae604899dc34 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationInner.java @@ -0,0 +1,248 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import java.util.Map; +import java.util.UUID; +import java.math.BigDecimal; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Reservation recommendation resource. + */ +@JsonFlatten +public class ReservationRecommendationInner { + /** + * Resource Id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Resource sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private String sku; + + /** + * The number of days of usage to look back for recommendation. + */ + @JsonProperty(value = "properties.lookBackPeriod", access = JsonProperty.Access.WRITE_ONLY) + private String lookBackPeriod; + + /** + * The meter id (GUID). + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private UUID meterId; + + /** + * RI recommendations in one or three year terms. + */ + @JsonProperty(value = "properties.term", access = JsonProperty.Access.WRITE_ONLY) + private String term; + + /** + * The total amount of cost without reserved instances. + */ + @JsonProperty(value = "properties.costWithNoReservedInstances", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal costWithNoReservedInstances; + + /** + * Recommended quality for reserved instances. + */ + @JsonProperty(value = "properties.recommendedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal recommendedQuantity; + + /** + * The total amount of cost with reserved instances. + */ + @JsonProperty(value = "properties.totalCostWithReservedInstances", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalCostWithReservedInstances; + + /** + * Total estimated savings with reserved instances. + */ + @JsonProperty(value = "properties.netSavings", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal netSavings; + + /** + * The usage date for looking back. + */ + @JsonProperty(value = "properties.firstUsageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime firstUsageDate; + + /** + * Shared or single recommendation. + */ + @JsonProperty(value = "properties.scope", access = JsonProperty.Access.WRITE_ONLY) + private String scope; + + /** + * Get resource Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get resource name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get resource type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Get resource location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get resource sku. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Get the number of days of usage to look back for recommendation. + * + * @return the lookBackPeriod value + */ + public String lookBackPeriod() { + return this.lookBackPeriod; + } + + /** + * Get the meter id (GUID). + * + * @return the meterId value + */ + public UUID meterId() { + return this.meterId; + } + + /** + * Get rI recommendations in one or three year terms. + * + * @return the term value + */ + public String term() { + return this.term; + } + + /** + * Get the total amount of cost without reserved instances. + * + * @return the costWithNoReservedInstances value + */ + public BigDecimal costWithNoReservedInstances() { + return this.costWithNoReservedInstances; + } + + /** + * Get recommended quality for reserved instances. + * + * @return the recommendedQuantity value + */ + public BigDecimal recommendedQuantity() { + return this.recommendedQuantity; + } + + /** + * Get the total amount of cost with reserved instances. + * + * @return the totalCostWithReservedInstances value + */ + public BigDecimal totalCostWithReservedInstances() { + return this.totalCostWithReservedInstances; + } + + /** + * Get total estimated savings with reserved instances. + * + * @return the netSavings value + */ + public BigDecimal netSavings() { + return this.netSavings; + } + + /** + * Get the usage date for looking back. + * + * @return the firstUsageDate value + */ + public DateTime firstUsageDate() { + return this.firstUsageDate; + } + + /** + * Get shared or single recommendation. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationsImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationsImpl.java new file mode 100644 index 0000000000000..f2b1b6de4d6df --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationsImpl.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. + * def + */ + +package com.microsoft.azure.management.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationRecommendations; +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationRecommendation; +import rx.Observable; +import rx.Completable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class ReservationRecommendationsImpl extends GroupableResourcesCoreImpl implements ReservationRecommendations { + protected ReservationRecommendationsImpl(ConsumptionManager manager) { + super(manager.inner().reservationRecommendations(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + return null; // NOP Retrieve by resource group not supported + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ReservationRecommendationsInner client = this.inner(); + return Completable.error(new Throwable("Delete by RG not supported for this resource")); // NOP Delete by RG not supported + } + + @Override + public PagedList list() { + ReservationRecommendationsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ReservationRecommendationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReservationRecommendation call(ReservationRecommendationInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + protected ReservationRecommendationImpl wrapModel(ReservationRecommendationInner inner) { + return new ReservationRecommendationImpl(inner.name(), inner, manager()); + } + + @Override + protected ReservationRecommendationImpl wrapModel(String name) { + return null; // Model is not creatable + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationsInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationsInner.java new file mode 100644 index 0000000000000..fdcd3dd5d7936 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationRecommendationsInner.java @@ -0,0 +1,393 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +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.Path; +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 ReservationRecommendations. + */ +public class ReservationRecommendationsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationRecommendationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationRecommendationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationRecommendationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationRecommendationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationRecommendations to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationRecommendationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.ReservationRecommendations list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Consumption/reservationRecommendations") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @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.consumption.v2018_06_30.ReservationRecommendations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationRecommendationInner> 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(); + } + }; + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @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); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationRecommendationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationRecommendationInner> 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)); + } + }); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationRecommendationInner> 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; + return service.list(this.client.subscriptionId(), filter, 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); + } + } + }); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param filter May be used to filter reservationRecommendations by properties/scope and properties/lookBackPeriod. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationRecommendationInner> object if successful. + */ + public PagedList list(final String filter) { + ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param filter May be used to filter reservationRecommendations by properties/scope and properties/lookBackPeriod. + * @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 ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param filter May be used to filter reservationRecommendations by properties/scope and properties/lookBackPeriod. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationRecommendationInner> object + */ + public Observable> listAsync(final String filter) { + return listWithServiceResponseAsync(filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param filter May be used to filter reservationRecommendations by properties/scope and properties/lookBackPeriod. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationRecommendationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter) { + return listSinglePageAsync(filter) + .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)); + } + }); + } + + /** + * List of recommendations for purchasing reserved instances. + * + ServiceResponse> * @param filter May be used to filter reservationRecommendations by properties/scope and properties/lookBackPeriod. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationRecommendationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter) { + 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(), filter, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationRecommendationInner> 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(); + } + }; + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @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); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @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<ReservationRecommendationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List of recommendations for purchasing reserved instances. + * + * @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<ReservationRecommendationInner> 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)); + } + }); + } + + /** + * List of recommendations for purchasing reserved instances. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationRecommendationInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationSummaryImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationSummaryImpl.java new file mode 100644 index 0000000000000..c67f635c60b11 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationSummaryImpl.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. + */ + +package com.microsoft.azure.management.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationSummary; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummaryImpl extends WrapperImpl implements ReservationSummary { + private final ConsumptionManager manager; + ReservationSummaryImpl(ReservationSummaryInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationSummaryInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationSummaryInner.java new file mode 100644 index 0000000000000..c0ad59867211f --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationSummaryInner.java @@ -0,0 +1,188 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summary resource. + */ +@JsonFlatten +public class ReservationSummaryInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsDetailsImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 0000000000000..1a9c6ea4ff8da --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsDetailsImpl.java @@ -0,0 +1,67 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationDetail; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listByReservationOrderAsync(final String reservationOrderId, final String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listByReservationOrderAsync(reservationOrderId, filter) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReservationDetail call(ReservationDetailInner inner) { + return new ReservationDetailImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByReservationOrderAndReservationAsync(final String reservationOrderId, final String reservationId, final String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listByReservationOrderAndReservationAsync(reservationOrderId, reservationId, filter) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReservationDetail call(ReservationDetailInner inner) { + return new ReservationDetailImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsDetailsInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 0000000000000..4f91a2e655be4 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,547 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +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.Path; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.ReservationsDetails listByReservationOrder" }) + @GET("providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.Consumption/reservationDetails") + Observable> listByReservationOrder(@Path("reservationOrderId") String reservationOrderId, @Query("$filter") String filter, @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.consumption.v2018_06_30.ReservationsDetails listByReservationOrderAndReservation" }) + @GET("providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.Consumption/reservationDetails") + Observable> listByReservationOrderAndReservation(@Path("reservationOrderId") String reservationOrderId, @Path("reservationId") String reservationId, @Query("$filter") String filter, @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.consumption.v2018_06_30.ReservationsDetails listByReservationOrderNext" }) + @GET + Observable> listByReservationOrderNext(@Url String nextUrl, @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.consumption.v2018_06_30.ReservationsDetails listByReservationOrderAndReservationNext" }) + @GET + Observable> listByReservationOrderAndReservationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationDetailInner> object if successful. + */ + public PagedList listByReservationOrder(final String reservationOrderId, final String filter) { + ServiceResponse> response = listByReservationOrderSinglePageAsync(reservationOrderId, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @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> listByReservationOrderAsync(final String reservationOrderId, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByReservationOrderSinglePageAsync(reservationOrderId, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationDetailInner> object + */ + public Observable> listByReservationOrderAsync(final String reservationOrderId, final String filter) { + return listByReservationOrderWithServiceResponseAsync(reservationOrderId, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationDetailInner> object + */ + public Observable>> listByReservationOrderWithServiceResponseAsync(final String reservationOrderId, final String filter) { + return listByReservationOrderSinglePageAsync(reservationOrderId, filter) + .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(listByReservationOrderNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + ServiceResponse> * @param reservationOrderId Order Id of the reservation + ServiceResponse> * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByReservationOrderSinglePageAsync(final String reservationOrderId, final String filter) { + if (reservationOrderId == null) { + throw new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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.listByReservationOrder(reservationOrderId, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByReservationOrderDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByReservationOrderDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationDetailInner> object if successful. + */ + public PagedList listByReservationOrderAndReservation(final String reservationOrderId, final String reservationId, final String filter) { + ServiceResponse> response = listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @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> listByReservationOrderAndReservationAsync(final String reservationOrderId, final String reservationId, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationDetailInner> object + */ + public Observable> listByReservationOrderAndReservationAsync(final String reservationOrderId, final String reservationId, final String filter) { + return listByReservationOrderAndReservationWithServiceResponseAsync(reservationOrderId, reservationId, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationDetailInner> object + */ + public Observable>> listByReservationOrderAndReservationWithServiceResponseAsync(final String reservationOrderId, final String reservationId, final String filter) { + return listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, filter) + .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(listByReservationOrderAndReservationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + ServiceResponse> * @param reservationOrderId Order Id of the reservation + ServiceResponse> * @param reservationId Id of the reservation + ServiceResponse> * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByReservationOrderAndReservationSinglePageAsync(final String reservationOrderId, final String reservationId, final String filter) { + if (reservationOrderId == null) { + throw new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null."); + } + if (reservationId == null) { + throw new IllegalArgumentException("Parameter reservationId is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter 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.listByReservationOrderAndReservation(reservationOrderId, reservationId, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByReservationOrderAndReservationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByReservationOrderAndReservationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the reservations details for provided date range. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationDetailInner> object if successful. + */ + public PagedList listByReservationOrderNext(final String nextPageLink) { + ServiceResponse> response = listByReservationOrderNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the reservations details for provided date range. + * + * @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> listByReservationOrderNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByReservationOrderNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @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<ReservationDetailInner> object + */ + public Observable> listByReservationOrderNextAsync(final String nextPageLink) { + return listByReservationOrderNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @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<ReservationDetailInner> object + */ + public Observable>> listByReservationOrderNextWithServiceResponseAsync(final String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(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(listByReservationOrderNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByReservationOrderNextSinglePageAsync(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.listByReservationOrderNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByReservationOrderNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByReservationOrderNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the reservations details for provided date range. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationDetailInner> object if successful. + */ + public PagedList listByReservationOrderAndReservationNext(final String nextPageLink) { + ServiceResponse> response = listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the reservations details for provided date range. + * + * @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> listByReservationOrderAndReservationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @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<ReservationDetailInner> object + */ + public Observable> listByReservationOrderAndReservationNextAsync(final String nextPageLink) { + return listByReservationOrderAndReservationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @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<ReservationDetailInner> object + */ + public Observable>> listByReservationOrderAndReservationNextWithServiceResponseAsync(final String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(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(listByReservationOrderAndReservationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByReservationOrderAndReservationNextSinglePageAsync(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.listByReservationOrderAndReservationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByReservationOrderAndReservationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByReservationOrderAndReservationNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsSummariesImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 0000000000000..59332a88ec1f1 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,68 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2018_06_30.ReservationSummary; +import com.microsoft.azure.management.consumption.v2018_06_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listByReservationOrderAsync(final String reservationOrderId, final Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listByReservationOrderAsync(reservationOrderId, grain) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReservationSummary call(ReservationSummaryInner inner) { + return new ReservationSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByReservationOrderAndReservationAsync(final String reservationOrderId, final String reservationId, final Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listByReservationOrderAndReservationAsync(reservationOrderId, reservationId, grain) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ReservationSummary call(ReservationSummaryInner inner) { + return new ReservationSummaryImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsSummariesInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 0000000000000..6fd974de21c85 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,794 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2018_06_30.Datagrain; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +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.Path; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.ReservationsSummaries listByReservationOrder" }) + @GET("providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/providers/Microsoft.Consumption/reservationSummaries") + Observable> listByReservationOrder(@Path("reservationOrderId") String reservationOrderId, @Query("grain") Datagrain grain1, @Query("$filter") String filter, @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.consumption.v2018_06_30.ReservationsSummaries listByReservationOrderAndReservation" }) + @GET("providers/Microsoft.Capacity/reservationorders/{reservationOrderId}/reservations/{reservationId}/providers/Microsoft.Consumption/reservationSummaries") + Observable> listByReservationOrderAndReservation(@Path("reservationOrderId") String reservationOrderId, @Path("reservationId") String reservationId, @Query("grain") Datagrain grain1, @Query("$filter") String filter, @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.consumption.v2018_06_30.ReservationsSummaries listByReservationOrderNext" }) + @GET + Observable> listByReservationOrderNext(@Url String nextUrl, @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.consumption.v2018_06_30.ReservationsSummaries listByReservationOrderAndReservationNext" }) + @GET + Observable> listByReservationOrderAndReservationNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationSummaryInner> object if successful. + */ + public PagedList listByReservationOrder(final String reservationOrderId, final Datagrain grain) { + ServiceResponse> response = listByReservationOrderSinglePageAsync(reservationOrderId, grain).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @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> listByReservationOrderAsync(final String reservationOrderId, final Datagrain grain, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByReservationOrderSinglePageAsync(reservationOrderId, grain), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationSummaryInner> object + */ + public Observable> listByReservationOrderAsync(final String reservationOrderId, final Datagrain grain) { + return listByReservationOrderWithServiceResponseAsync(reservationOrderId, grain) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationSummaryInner> object + */ + public Observable>> listByReservationOrderWithServiceResponseAsync(final String reservationOrderId, final Datagrain grain) { + return listByReservationOrderSinglePageAsync(reservationOrderId, grain) + .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(listByReservationOrderNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByReservationOrderSinglePageAsync(final String reservationOrderId, final Datagrain grain) { + if (reservationOrderId == null) { + throw new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain 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; + return service.listByReservationOrder(reservationOrderId, grain, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByReservationOrderDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationSummaryInner> object if successful. + */ + public PagedList listByReservationOrder(final String reservationOrderId, final Datagrain grain, final String filter) { + ServiceResponse> response = listByReservationOrderSinglePageAsync(reservationOrderId, grain, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @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> listByReservationOrderAsync(final String reservationOrderId, final Datagrain grain, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByReservationOrderSinglePageAsync(reservationOrderId, grain, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationSummaryInner> object + */ + public Observable> listByReservationOrderAsync(final String reservationOrderId, final Datagrain grain, final String filter) { + return listByReservationOrderWithServiceResponseAsync(reservationOrderId, grain, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationSummaryInner> object + */ + public Observable>> listByReservationOrderWithServiceResponseAsync(final String reservationOrderId, final Datagrain grain, final String filter) { + return listByReservationOrderSinglePageAsync(reservationOrderId, grain, filter) + .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(listByReservationOrderNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + ServiceResponse> * @param reservationOrderId Order Id of the reservation + ServiceResponse> * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + ServiceResponse> * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByReservationOrderSinglePageAsync(final String reservationOrderId, final Datagrain grain, final String filter) { + if (reservationOrderId == null) { + throw new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain 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.listByReservationOrder(reservationOrderId, grain, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByReservationOrderDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByReservationOrderDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationSummaryInner> object if successful. + */ + public PagedList listByReservationOrderAndReservation(final String reservationOrderId, final String reservationId, final Datagrain grain) { + ServiceResponse> response = listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, grain).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @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> listByReservationOrderAndReservationAsync(final String reservationOrderId, final String reservationId, final Datagrain grain, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, grain), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationSummaryInner> object + */ + public Observable> listByReservationOrderAndReservationAsync(final String reservationOrderId, final String reservationId, final Datagrain grain) { + return listByReservationOrderAndReservationWithServiceResponseAsync(reservationOrderId, reservationId, grain) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationSummaryInner> object + */ + public Observable>> listByReservationOrderAndReservationWithServiceResponseAsync(final String reservationOrderId, final String reservationId, final Datagrain grain) { + return listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, grain) + .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(listByReservationOrderAndReservationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByReservationOrderAndReservationSinglePageAsync(final String reservationOrderId, final String reservationId, final Datagrain grain) { + if (reservationOrderId == null) { + throw new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null."); + } + if (reservationId == null) { + throw new IllegalArgumentException("Parameter reservationId is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain 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; + return service.listByReservationOrderAndReservation(reservationOrderId, reservationId, grain, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByReservationOrderAndReservationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationSummaryInner> object if successful. + */ + public PagedList listByReservationOrderAndReservation(final String reservationOrderId, final String reservationId, final Datagrain grain, final String filter) { + ServiceResponse> response = listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, grain, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @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> listByReservationOrderAndReservationAsync(final String reservationOrderId, final String reservationId, final Datagrain grain, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, grain, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationSummaryInner> object + */ + public Observable> listByReservationOrderAndReservationAsync(final String reservationOrderId, final String reservationId, final Datagrain grain, final String filter) { + return listByReservationOrderAndReservationWithServiceResponseAsync(reservationOrderId, reservationId, grain, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the reservation + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ReservationSummaryInner> object + */ + public Observable>> listByReservationOrderAndReservationWithServiceResponseAsync(final String reservationOrderId, final String reservationId, final Datagrain grain, final String filter) { + return listByReservationOrderAndReservationSinglePageAsync(reservationOrderId, reservationId, grain, filter) + .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(listByReservationOrderAndReservationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + ServiceResponse> * @param reservationOrderId Order Id of the reservation + ServiceResponse> * @param reservationId Id of the reservation + ServiceResponse> * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + ServiceResponse> * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByReservationOrderAndReservationSinglePageAsync(final String reservationOrderId, final String reservationId, final Datagrain grain, final String filter) { + if (reservationOrderId == null) { + throw new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null."); + } + if (reservationId == null) { + throw new IllegalArgumentException("Parameter reservationId is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain 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.listByReservationOrderAndReservation(reservationOrderId, reservationId, grain, filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByReservationOrderAndReservationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByReservationOrderAndReservationDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationSummaryInner> object if successful. + */ + public PagedList listByReservationOrderNext(final String nextPageLink) { + ServiceResponse> response = listByReservationOrderNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @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> listByReservationOrderNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByReservationOrderNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @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<ReservationSummaryInner> object + */ + public Observable> listByReservationOrderNextAsync(final String nextPageLink) { + return listByReservationOrderNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @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<ReservationSummaryInner> object + */ + public Observable>> listByReservationOrderNextWithServiceResponseAsync(final String nextPageLink) { + return listByReservationOrderNextSinglePageAsync(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(listByReservationOrderNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByReservationOrderNextSinglePageAsync(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.listByReservationOrderNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByReservationOrderNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByReservationOrderNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ReservationSummaryInner> object if successful. + */ + public PagedList listByReservationOrderAndReservationNext(final String nextPageLink) { + ServiceResponse> response = listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @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> listByReservationOrderAndReservationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @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<ReservationSummaryInner> object + */ + public Observable> listByReservationOrderAndReservationNextAsync(final String nextPageLink) { + return listByReservationOrderAndReservationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @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<ReservationSummaryInner> object + */ + public Observable>> listByReservationOrderAndReservationNextWithServiceResponseAsync(final String nextPageLink) { + return listByReservationOrderAndReservationNextSinglePageAsync(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(listByReservationOrderAndReservationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ReservationSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByReservationOrderAndReservationNextSinglePageAsync(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.listByReservationOrderAndReservationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByReservationOrderAndReservationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByReservationOrderAndReservationNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagInner.java new file mode 100644 index 0000000000000..57e1980dd1b55 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagInner.java @@ -0,0 +1,43 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The tag resource. + */ +public class TagInner { + /** + * Tag key. + */ + @JsonProperty(value = "key") + private String key; + + /** + * Get tag key. + * + * @return the key value + */ + public String key() { + return this.key; + } + + /** + * Set tag key. + * + * @param key the key value to set + * @return the TagInner object itself. + */ + public TagInner withKey(String key) { + this.key = key; + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsImpl.java new file mode 100644 index 0000000000000..ce777b882f95f --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsImpl.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. + * abc + */ + +package com.microsoft.azure.management.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.Tags; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_06_30.TagsResult; + +class TagsImpl extends WrapperImpl implements Tags { + private final ConsumptionManager manager; + + TagsImpl(ConsumptionManager manager) { + super(manager.inner().tags()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String billingAccountId) { + TagsInner client = this.inner(); + return client.getAsync(billingAccountId) + .map(new Func1() { + @Override + public TagsResult call(TagsResultInner inner) { + return new TagsResultImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsInner.java new file mode 100644 index 0000000000000..56e6a8ba4f597 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsInner.java @@ -0,0 +1,136 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 Tags. + */ +public class TagsInner { + /** The Retrofit service to perform REST calls. */ + private TagsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of TagsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TagsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(TagsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Tags to be + * used by Retrofit to perform actually REST calls. + */ + interface TagsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.Tags get" }) + @GET("providers/Microsoft.CostManagement/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/tags") + Observable> get(@Path("billingAccountId") String billingAccountId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get all available tag keys for a billing account. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TagsResultInner object if successful. + */ + public TagsResultInner get(String billingAccountId) { + return getWithServiceResponseAsync(billingAccountId).toBlocking().single().body(); + } + + /** + * Get all available tag keys for a billing account. + * + * @param billingAccountId BillingAccount 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 billingAccountId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountId), serviceCallback); + } + + /** + * Get all available tag keys for a billing account. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagsResultInner object + */ + public Observable getAsync(String billingAccountId) { + return getWithServiceResponseAsync(billingAccountId).map(new Func1, TagsResultInner>() { + @Override + public TagsResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get all available tag keys for a billing account. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TagsResultInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountId) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId 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(billingAccountId, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsResultImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsResultImpl.java new file mode 100644 index 0000000000000..b2cbfa9c8992c --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsResultImpl.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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.TagsResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class TagsResultImpl extends WrapperImpl implements TagsResult { + private final ConsumptionManager manager; + TagsResultImpl(TagsResultInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String eTag() { + return this.inner().eTag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsResultInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsResultInner.java new file mode 100644 index 0000000000000..3c8e7ed22ed74 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/TagsResultInner.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.consumption.v2018_06_30.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A resource listing all tags. + */ +@JsonFlatten +public class TagsResultInner extends ProxyResource { + /** + * A list of Tag. + */ + @JsonProperty(value = "properties.tags") + private List tags; + + /** + * eTag of the resource. To handle concurrent update scenario, this field + * will be used to determine whether the user is updating the latest + * version or not. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * Get a list of Tag. + * + * @return the tags value + */ + public List tags() { + return this.tags; + } + + /** + * Set a list of Tag. + * + * @param tags the tags value to set + * @return the TagsResultInner object itself. + */ + public TagsResultInner withTags(List tags) { + this.tags = tags; + return this; + } + + /** + * Get eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set eTag of the resource. To handle concurrent update scenario, this field will be used to determine whether the user is updating the latest version or not. + * + * @param eTag the eTag value to set + * @return the TagsResultInner object itself. + */ + public TagsResultInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailImpl.java new file mode 100644 index 0000000000000..f0fbcc99426e9 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailImpl.java @@ -0,0 +1,186 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.management.consumption.v2018_06_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2018_06_30.MeterDetails; +import java.util.UUID; +import java.util.Map; +import org.joda.time.DateTime; + +class UsageDetailImpl extends WrapperImpl implements UsageDetail { + private final ConsumptionManager manager; + UsageDetailImpl(UsageDetailInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String accountName() { + return this.inner().accountName(); + } + + @Override + public String additionalProperties() { + return this.inner().additionalProperties(); + } + + @Override + public BigDecimal billableQuantity() { + return this.inner().billableQuantity(); + } + + @Override + public String billingPeriodId() { + return this.inner().billingPeriodId(); + } + + @Override + public Boolean chargesBilledSeparately() { + return this.inner().chargesBilledSeparately(); + } + + @Override + public String consumedService() { + return this.inner().consumedService(); + } + + @Override + public String costCenter() { + return this.inner().costCenter(); + } + + @Override + public String currency() { + return this.inner().currency(); + } + + @Override + public String departmentName() { + return this.inner().departmentName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String instanceLocation() { + return this.inner().instanceLocation(); + } + + @Override + public String instanceName() { + return this.inner().instanceName(); + } + + @Override + public String invoiceId() { + return this.inner().invoiceId(); + } + + @Override + public Boolean isEstimated() { + return this.inner().isEstimated(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public MeterDetails meterDetails() { + return this.inner().meterDetails(); + } + + @Override + public UUID meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String offerId() { + return this.inner().offerId(); + } + + @Override + public String partNumber() { + return this.inner().partNumber(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String resourceGuid() { + return this.inner().resourceGuid(); + } + + @Override + public UUID subscriptionGuid() { + return this.inner().subscriptionGuid(); + } + + @Override + public String subscriptionName() { + return this.inner().subscriptionName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageEnd() { + return this.inner().usageEnd(); + } + + @Override + public BigDecimal usageQuantity() { + return this.inner().usageQuantity(); + } + + @Override + public DateTime usageStart() { + return this.inner().usageStart(); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailInner.java new file mode 100644 index 0000000000000..d668b91bd3036 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailInner.java @@ -0,0 +1,448 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import java.util.UUID; +import com.microsoft.azure.management.consumption.v2018_06_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id (GUID). + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private UUID meterId; + + /** + * The details about the meter. By default this is not populated, unless + * it's specified in $expand. + */ + @JsonProperty(value = "properties.meterDetails", access = JsonProperty.Access.WRITE_ONLY) + private MeterDetails meterDetails; + + /** + * Subscription guid. + */ + @JsonProperty(value = "properties.subscriptionGuid", access = JsonProperty.Access.WRITE_ONLY) + private UUID subscriptionGuid; + + /** + * Subscription name. + */ + @JsonProperty(value = "properties.subscriptionName", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionName; + + /** + * Account name. + */ + @JsonProperty(value = "properties.accountName", access = JsonProperty.Access.WRITE_ONLY) + private String accountName; + + /** + * Department name. + */ + @JsonProperty(value = "properties.departmentName", access = JsonProperty.Access.WRITE_ONLY) + private String departmentName; + + /** + * Product name. + */ + @JsonProperty(value = "properties.product", access = JsonProperty.Access.WRITE_ONLY) + private String product; + + /** + * Consumed service name. + */ + @JsonProperty(value = "properties.consumedService", access = JsonProperty.Access.WRITE_ONLY) + private String consumedService; + + /** + * The cost center of this department if it is a department and a + * costcenter exists. + */ + @JsonProperty(value = "properties.costCenter", access = JsonProperty.Access.WRITE_ONLY) + private String costCenter; + + /** + * Part Number. + */ + @JsonProperty(value = "properties.partNumber", access = JsonProperty.Access.WRITE_ONLY) + private String partNumber; + + /** + * Resource Guid. + */ + @JsonProperty(value = "properties.resourceGuid", access = JsonProperty.Access.WRITE_ONLY) + private String resourceGuid; + + /** + * Offer Id. + */ + @JsonProperty(value = "properties.offerId", access = JsonProperty.Access.WRITE_ONLY) + private String offerId; + + /** + * Charges billed separately. + */ + @JsonProperty(value = "properties.chargesBilledSeparately", access = JsonProperty.Access.WRITE_ONLY) + private Boolean chargesBilledSeparately; + + /** + * Resource Location. + */ + @JsonProperty(value = "properties.location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /** + * Additional details of this usage item. By default this is not populated, + * unless it's specified in $expand. + */ + @JsonProperty(value = "properties.additionalProperties", access = JsonProperty.Access.WRITE_ONLY) + private String additionalProperties; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the id of the billing period resource that the usage belongs to. + * + * @return the billingPeriodId value + */ + public String billingPeriodId() { + return this.billingPeriodId; + } + + /** + * Get the id of the invoice resource that the usage belongs to. + * + * @return the invoiceId value + */ + public String invoiceId() { + return this.invoiceId; + } + + /** + * Get the start of the date time range covered by the usage detail. + * + * @return the usageStart value + */ + public DateTime usageStart() { + return this.usageStart; + } + + /** + * Get the end of the date time range covered by the usage detail. + * + * @return the usageEnd value + */ + public DateTime usageEnd() { + return this.usageEnd; + } + + /** + * Get the name of the resource instance that the usage is about. + * + * @return the instanceName value + */ + public String instanceName() { + return this.instanceName; + } + + /** + * Get the uri of the resource instance that the usage is about. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get the location of the resource instance that the usage is about. + * + * @return the instanceLocation value + */ + public String instanceLocation() { + return this.instanceLocation; + } + + /** + * Get the ISO currency in which the meter is charged, for example, USD. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get the quantity of usage. + * + * @return the usageQuantity value + */ + public BigDecimal usageQuantity() { + return this.usageQuantity; + } + + /** + * Get the billable usage quantity. + * + * @return the billableQuantity value + */ + public BigDecimal billableQuantity() { + return this.billableQuantity; + } + + /** + * Get the amount of cost before tax. + * + * @return the pretaxCost value + */ + public BigDecimal pretaxCost() { + return this.pretaxCost; + } + + /** + * Get the estimated usage is subject to change. + * + * @return the isEstimated value + */ + public Boolean isEstimated() { + return this.isEstimated; + } + + /** + * Get the meter id (GUID). + * + * @return the meterId value + */ + public UUID meterId() { + return this.meterId; + } + + /** + * Get the details about the meter. By default this is not populated, unless it's specified in $expand. + * + * @return the meterDetails value + */ + public MeterDetails meterDetails() { + return this.meterDetails; + } + + /** + * Get subscription guid. + * + * @return the subscriptionGuid value + */ + public UUID subscriptionGuid() { + return this.subscriptionGuid; + } + + /** + * Get subscription name. + * + * @return the subscriptionName value + */ + public String subscriptionName() { + return this.subscriptionName; + } + + /** + * Get account name. + * + * @return the accountName value + */ + public String accountName() { + return this.accountName; + } + + /** + * Get department name. + * + * @return the departmentName value + */ + public String departmentName() { + return this.departmentName; + } + + /** + * Get product name. + * + * @return the product value + */ + public String product() { + return this.product; + } + + /** + * Get consumed service name. + * + * @return the consumedService value + */ + public String consumedService() { + return this.consumedService; + } + + /** + * Get the cost center of this department if it is a department and a costcenter exists. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Get part Number. + * + * @return the partNumber value + */ + public String partNumber() { + return this.partNumber; + } + + /** + * Get resource Guid. + * + * @return the resourceGuid value + */ + public String resourceGuid() { + return this.resourceGuid; + } + + /** + * Get offer Id. + * + * @return the offerId value + */ + public String offerId() { + return this.offerId; + } + + /** + * Get charges billed separately. + * + * @return the chargesBilledSeparately value + */ + public Boolean chargesBilledSeparately() { + return this.chargesBilledSeparately; + } + + /** + * Get resource Location. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Get additional details of this usage item. By default this is not populated, unless it's specified in $expand. + * + * @return the additionalProperties value + */ + public String additionalProperties() { + return this.additionalProperties; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailsImpl.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailsImpl.java new file mode 100644 index 0000000000000..4526ac075623a --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailsImpl.java @@ -0,0 +1,211 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2018_06_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listByBillingPeriodAsync(final String billingPeriodName) { + UsageDetailsInner client = this.inner(); + return client.listByBillingPeriodAsync(billingPeriodName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UsageDetail call(UsageDetailInner inner) { + return new UsageDetailImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountId) { + UsageDetailsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UsageDetail call(UsageDetailInner inner) { + return new UsageDetailImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName) { + UsageDetailsInner client = this.inner(); + return client.listForBillingPeriodByBillingAccountAsync(billingAccountId, billingPeriodName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UsageDetail call(UsageDetailInner inner) { + return new UsageDetailImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByDepartmentAsync(final String departmentId) { + UsageDetailsInner client = this.inner(); + return client.listByDepartmentAsync(departmentId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UsageDetail call(UsageDetailInner inner) { + return new UsageDetailImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName) { + UsageDetailsInner client = this.inner(); + return client.listForBillingPeriodByDepartmentAsync(departmentId, billingPeriodName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UsageDetail call(UsageDetailInner inner) { + return new UsageDetailImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByEnrollmentAccountAsync(final String enrollmentAccountId) { + UsageDetailsInner client = this.inner(); + return client.listByEnrollmentAccountAsync(enrollmentAccountId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UsageDetail call(UsageDetailInner inner) { + return new UsageDetailImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName) { + UsageDetailsInner client = this.inner(); + return client.listForBillingPeriodByEnrollmentAccountAsync(enrollmentAccountId, billingPeriodName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UsageDetail call(UsageDetailInner inner) { + return new UsageDetailImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByManagementGroupAsync(final String managementGroupId) { + UsageDetailsInner client = this.inner(); + return client.listByManagementGroupAsync(managementGroupId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UsageDetail call(UsageDetailInner inner) { + return new UsageDetailImpl(inner, manager()); + } + }); + } + + @Override + public Observable listForBillingPeriodByManagementGroupAsync(final String managementGroupId, final String billingPeriodName) { + UsageDetailsInner client = this.inner(); + return client.listForBillingPeriodByManagementGroupAsync(managementGroupId, billingPeriodName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UsageDetail call(UsageDetailInner inner) { + return new UsageDetailImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + UsageDetailsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public UsageDetail call(UsageDetailInner inner) { + return new UsageDetailImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailsInner.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailsInner.java new file mode 100644 index 0000000000000..2ca47c19b5da2 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/UsageDetailsInner.java @@ -0,0 +1,3843 @@ +/** + * 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.consumption.v2018_06_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2018_06_30.ErrorResponseException; +import com.microsoft.azure.management.consumption.v2018_06_30.QueryOptions; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +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.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +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 UsageDetails. + */ +public class UsageDetailsInner { + /** The Retrofit service to perform REST calls. */ + private UsageDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of UsageDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsageDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(UsageDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for UsageDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface UsageDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails listByBillingPeriod" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails") + Observable> listByBillingPeriod(@Path("subscriptionId") String subscriptionId, @Path("billingPeriodName") String billingPeriodName, @Query("$expand") String expand, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Consumption/usageDetails") + Observable> listByBillingAccount(@Path("billingAccountId") String billingAccountId, @Query("$expand") String expand, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails listForBillingPeriodByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails") + Observable> listForBillingPeriodByBillingAccount(@Path("billingAccountId") String billingAccountId, @Path("billingPeriodName") String billingPeriodName, @Query("$expand") String expand, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails listByDepartment" }) + @GET("providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Consumption/usageDetails") + Observable> listByDepartment(@Path("departmentId") String departmentId, @Query("$expand") String expand, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails listForBillingPeriodByDepartment" }) + @GET("providers/Microsoft.Billing/departments/{departmentId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails") + Observable> listForBillingPeriodByDepartment(@Path("departmentId") String departmentId, @Path("billingPeriodName") String billingPeriodName, @Query("$expand") String expand, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails listByEnrollmentAccount" }) + @GET("providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Consumption/usageDetails") + Observable> listByEnrollmentAccount(@Path("enrollmentAccountId") String enrollmentAccountId, @Query("$expand") String expand, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails listForBillingPeriodByEnrollmentAccount" }) + @GET("providers/Microsoft.Billing/enrollmentAccounts/{enrollmentAccountId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails") + Observable> listForBillingPeriodByEnrollmentAccount(@Path("enrollmentAccountId") String enrollmentAccountId, @Path("billingPeriodName") String billingPeriodName, @Query("$expand") String expand, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails listByManagementGroup" }) + @GET("providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Consumption/usageDetails") + Observable> listByManagementGroup(@Path("managementGroupId") String managementGroupId, @Query("$expand") String expand, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails listForBillingPeriodByManagementGroup" }) + @GET("providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}/providers/Microsoft.Consumption/usageDetails") + Observable> listForBillingPeriodByManagementGroup(@Path("managementGroupId") String managementGroupId, @Path("billingPeriodName") String billingPeriodName, @Query("$expand") String expand, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Query("$apply") String apply, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2018_06_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @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.consumption.v2018_06_30.UsageDetails listByBillingPeriodNext" }) + @GET + Observable> listByBillingPeriodNext(@Url String nextUrl, @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.consumption.v2018_06_30.UsageDetails listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @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.consumption.v2018_06_30.UsageDetails listForBillingPeriodByBillingAccountNext" }) + @GET + Observable> listForBillingPeriodByBillingAccountNext(@Url String nextUrl, @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.consumption.v2018_06_30.UsageDetails listByDepartmentNext" }) + @GET + Observable> listByDepartmentNext(@Url String nextUrl, @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.consumption.v2018_06_30.UsageDetails listForBillingPeriodByDepartmentNext" }) + @GET + Observable> listForBillingPeriodByDepartmentNext(@Url String nextUrl, @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.consumption.v2018_06_30.UsageDetails listByEnrollmentAccountNext" }) + @GET + Observable> listByEnrollmentAccountNext(@Url String nextUrl, @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.consumption.v2018_06_30.UsageDetails listForBillingPeriodByEnrollmentAccountNext" }) + @GET + Observable> listForBillingPeriodByEnrollmentAccountNext(@Url String nextUrl, @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.consumption.v2018_06_30.UsageDetails listByManagementGroupNext" }) + @GET + Observable> listByManagementGroupNext(@Url String nextUrl, @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.consumption.v2018_06_30.UsageDetails listForBillingPeriodByManagementGroupNext" }) + @GET + Observable> listForBillingPeriodByManagementGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> 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 the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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 the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> 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 the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> 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 expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final QueryOptions queryOptions = null; + String apply = null; + return service.list(this.client.subscriptionId(), expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, 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); + } + } + }); + } + + /** + * Lists the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList list(final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + ServiceResponse> response = listSinglePageAsync(expand, filter, skiptoken, top, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @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 expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(expand, filter, skiptoken, top, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listWithServiceResponseAsync(expand, filter, skiptoken, top, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listSinglePageAsync(expand, filter, skiptoken, top, queryOptions) + .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 the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + ServiceResponse> * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + 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."); + } + Validator.validate(queryOptions); + String apply = null; + if (queryOptions != null) { + apply = queryOptions.apply(); + } + return service.list(this.client.subscriptionId(), expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByBillingPeriod(final String billingPeriodName) { + ServiceResponse> response = listByBillingPeriodSinglePageAsync(billingPeriodName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @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> listByBillingPeriodAsync(final String billingPeriodName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingPeriodSinglePageAsync(billingPeriodName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listByBillingPeriodAsync(final String billingPeriodName) { + return listByBillingPeriodWithServiceResponseAsync(billingPeriodName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listByBillingPeriodWithServiceResponseAsync(final String billingPeriodName) { + return listByBillingPeriodSinglePageAsync(billingPeriodName) + .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(listByBillingPeriodNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingPeriodSinglePageAsync(final String billingPeriodName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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 expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final QueryOptions queryOptions = null; + String apply = null; + return service.listByBillingPeriod(this.client.subscriptionId(), billingPeriodName, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingPeriodDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByBillingPeriod(final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + ServiceResponse> response = listByBillingPeriodSinglePageAsync(billingPeriodName, expand, filter, skiptoken, top, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @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> listByBillingPeriodAsync(final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingPeriodSinglePageAsync(billingPeriodName, expand, filter, skiptoken, top, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listByBillingPeriodAsync(final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listByBillingPeriodWithServiceResponseAsync(billingPeriodName, expand, filter, skiptoken, top, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listByBillingPeriodWithServiceResponseAsync(final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listByBillingPeriodSinglePageAsync(billingPeriodName, expand, filter, skiptoken, top, queryOptions) + .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(listByBillingPeriodNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param billingPeriodName Billing Period Name. + ServiceResponse> * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + ServiceResponse> * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingPeriodSinglePageAsync(final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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(queryOptions); + String apply = null; + if (queryOptions != null) { + apply = queryOptions.apply(); + } + return service.listByBillingPeriod(this.client.subscriptionId(), billingPeriodName, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingPeriodDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingPeriodDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountId) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount 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> listByBillingAccountAsync(final String billingAccountId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountId) { + return listByBillingAccountWithServiceResponseAsync(billingAccountId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountId) { + return listByBillingAccountSinglePageAsync(billingAccountId) + .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(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountId) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId 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 expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final QueryOptions queryOptions = null; + String apply = null; + return service.listByBillingAccount(billingAccountId, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountId, expand, filter, skiptoken, top, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @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> listByBillingAccountAsync(final String billingAccountId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountId, expand, filter, skiptoken, top, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listByBillingAccountWithServiceResponseAsync(billingAccountId, expand, filter, skiptoken, top, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listByBillingAccountSinglePageAsync(billingAccountId, expand, filter, skiptoken, top, queryOptions) + .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(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param billingAccountId BillingAccount ID + ServiceResponse> * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + ServiceResponse> * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId 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(queryOptions); + String apply = null; + if (queryOptions != null) { + apply = queryOptions.apply(); + } + return service.listByBillingAccount(billingAccountId, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByBillingAccount(final String billingAccountId, final String billingPeriodName) { + ServiceResponse> response = listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @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> listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName) { + return listForBillingPeriodByBillingAccountWithServiceResponseAsync(billingAccountId, billingPeriodName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByBillingAccountWithServiceResponseAsync(final String billingAccountId, final String billingPeriodName) { + return listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName) + .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(listForBillingPeriodByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByBillingAccountSinglePageAsync(final String billingAccountId, final String billingPeriodName) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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 expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final QueryOptions queryOptions = null; + String apply = null; + return service.listForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByBillingAccount(final String billingAccountId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + ServiceResponse> response = listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName, expand, filter, skiptoken, top, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @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> listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName, expand, filter, skiptoken, top, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByBillingAccountAsync(final String billingAccountId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listForBillingPeriodByBillingAccountWithServiceResponseAsync(billingAccountId, billingPeriodName, expand, filter, skiptoken, top, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param billingAccountId BillingAccount ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByBillingAccountWithServiceResponseAsync(final String billingAccountId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listForBillingPeriodByBillingAccountSinglePageAsync(billingAccountId, billingPeriodName, expand, filter, skiptoken, top, queryOptions) + .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(listForBillingPeriodByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param billingAccountId BillingAccount ID + ServiceResponse> * @param billingPeriodName Billing Period Name. + ServiceResponse> * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + ServiceResponse> * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByBillingAccountSinglePageAsync(final String billingAccountId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + if (billingAccountId == null) { + throw new IllegalArgumentException("Parameter billingAccountId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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(queryOptions); + String apply = null; + if (queryOptions != null) { + apply = queryOptions.apply(); + } + return service.listForBillingPeriodByBillingAccount(billingAccountId, billingPeriodName, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByDepartment(final String departmentId) { + ServiceResponse> response = listByDepartmentSinglePageAsync(departmentId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department 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> listByDepartmentAsync(final String departmentId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentSinglePageAsync(departmentId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listByDepartmentAsync(final String departmentId) { + return listByDepartmentWithServiceResponseAsync(departmentId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listByDepartmentWithServiceResponseAsync(final String departmentId) { + return listByDepartmentSinglePageAsync(departmentId) + .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(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentSinglePageAsync(final String departmentId) { + if (departmentId == null) { + throw new IllegalArgumentException("Parameter departmentId 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 expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final QueryOptions queryOptions = null; + String apply = null; + return service.listByDepartment(departmentId, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByDepartment(final String departmentId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + ServiceResponse> response = listByDepartmentSinglePageAsync(departmentId, expand, filter, skiptoken, top, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @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> listByDepartmentAsync(final String departmentId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentSinglePageAsync(departmentId, expand, filter, skiptoken, top, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listByDepartmentAsync(final String departmentId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listByDepartmentWithServiceResponseAsync(departmentId, expand, filter, skiptoken, top, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listByDepartmentWithServiceResponseAsync(final String departmentId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listByDepartmentSinglePageAsync(departmentId, expand, filter, skiptoken, top, queryOptions) + .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(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param departmentId Department ID + ServiceResponse> * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + ServiceResponse> * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentSinglePageAsync(final String departmentId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + if (departmentId == null) { + throw new IllegalArgumentException("Parameter departmentId 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(queryOptions); + String apply = null; + if (queryOptions != null) { + apply = queryOptions.apply(); + } + return service.listByDepartment(departmentId, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDepartmentDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByDepartment(final String departmentId, final String billingPeriodName) { + ServiceResponse> response = listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @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> listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName) { + return listForBillingPeriodByDepartmentWithServiceResponseAsync(departmentId, billingPeriodName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByDepartmentWithServiceResponseAsync(final String departmentId, final String billingPeriodName) { + return listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName) + .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(listForBillingPeriodByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByDepartmentSinglePageAsync(final String departmentId, final String billingPeriodName) { + if (departmentId == null) { + throw new IllegalArgumentException("Parameter departmentId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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 expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final QueryOptions queryOptions = null; + String apply = null; + return service.listForBillingPeriodByDepartment(departmentId, billingPeriodName, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByDepartmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByDepartment(final String departmentId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + ServiceResponse> response = listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName, expand, filter, skiptoken, top, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @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> listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName, expand, filter, skiptoken, top, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByDepartmentAsync(final String departmentId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listForBillingPeriodByDepartmentWithServiceResponseAsync(departmentId, billingPeriodName, expand, filter, skiptoken, top, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param departmentId Department ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByDepartmentWithServiceResponseAsync(final String departmentId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listForBillingPeriodByDepartmentSinglePageAsync(departmentId, billingPeriodName, expand, filter, skiptoken, top, queryOptions) + .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(listForBillingPeriodByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param departmentId Department ID + ServiceResponse> * @param billingPeriodName Billing Period Name. + ServiceResponse> * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + ServiceResponse> * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByDepartmentSinglePageAsync(final String departmentId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + if (departmentId == null) { + throw new IllegalArgumentException("Parameter departmentId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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(queryOptions); + String apply = null; + if (queryOptions != null) { + apply = queryOptions.apply(); + } + return service.listForBillingPeriodByDepartment(departmentId, billingPeriodName, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByDepartmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByDepartmentDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByEnrollmentAccount(final String enrollmentAccountId) { + ServiceResponse> response = listByEnrollmentAccountSinglePageAsync(enrollmentAccountId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount 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> listByEnrollmentAccountAsync(final String enrollmentAccountId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountSinglePageAsync(enrollmentAccountId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listByEnrollmentAccountAsync(final String enrollmentAccountId) { + return listByEnrollmentAccountWithServiceResponseAsync(enrollmentAccountId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listByEnrollmentAccountWithServiceResponseAsync(final String enrollmentAccountId) { + return listByEnrollmentAccountSinglePageAsync(enrollmentAccountId) + .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(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountSinglePageAsync(final String enrollmentAccountId) { + if (enrollmentAccountId == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountId 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 expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final QueryOptions queryOptions = null; + String apply = null; + return service.listByEnrollmentAccount(enrollmentAccountId, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByEnrollmentAccount(final String enrollmentAccountId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + ServiceResponse> response = listByEnrollmentAccountSinglePageAsync(enrollmentAccountId, expand, filter, skiptoken, top, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @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> listByEnrollmentAccountAsync(final String enrollmentAccountId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountSinglePageAsync(enrollmentAccountId, expand, filter, skiptoken, top, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listByEnrollmentAccountAsync(final String enrollmentAccountId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listByEnrollmentAccountWithServiceResponseAsync(enrollmentAccountId, expand, filter, skiptoken, top, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listByEnrollmentAccountWithServiceResponseAsync(final String enrollmentAccountId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listByEnrollmentAccountSinglePageAsync(enrollmentAccountId, expand, filter, skiptoken, top, queryOptions) + .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(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param enrollmentAccountId EnrollmentAccount ID + ServiceResponse> * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + ServiceResponse> * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountSinglePageAsync(final String enrollmentAccountId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + if (enrollmentAccountId == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountId 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(queryOptions); + String apply = null; + if (queryOptions != null) { + apply = queryOptions.apply(); + } + return service.listByEnrollmentAccount(enrollmentAccountId, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEnrollmentAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByEnrollmentAccount(final String enrollmentAccountId, final String billingPeriodName) { + ServiceResponse> response = listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @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> listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName) { + return listForBillingPeriodByEnrollmentAccountWithServiceResponseAsync(enrollmentAccountId, billingPeriodName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByEnrollmentAccountWithServiceResponseAsync(final String enrollmentAccountId, final String billingPeriodName) { + return listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName) + .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(listForBillingPeriodByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByEnrollmentAccountSinglePageAsync(final String enrollmentAccountId, final String billingPeriodName) { + if (enrollmentAccountId == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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 expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final QueryOptions queryOptions = null; + String apply = null; + return service.listForBillingPeriodByEnrollmentAccount(enrollmentAccountId, billingPeriodName, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByEnrollmentAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByEnrollmentAccount(final String enrollmentAccountId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + ServiceResponse> response = listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName, expand, filter, skiptoken, top, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @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> listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName, expand, filter, skiptoken, top, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByEnrollmentAccountAsync(final String enrollmentAccountId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listForBillingPeriodByEnrollmentAccountWithServiceResponseAsync(enrollmentAccountId, billingPeriodName, expand, filter, skiptoken, top, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param enrollmentAccountId EnrollmentAccount ID + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByEnrollmentAccountWithServiceResponseAsync(final String enrollmentAccountId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listForBillingPeriodByEnrollmentAccountSinglePageAsync(enrollmentAccountId, billingPeriodName, expand, filter, skiptoken, top, queryOptions) + .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(listForBillingPeriodByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param enrollmentAccountId EnrollmentAccount ID + ServiceResponse> * @param billingPeriodName Billing Period Name. + ServiceResponse> * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + ServiceResponse> * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByEnrollmentAccountSinglePageAsync(final String enrollmentAccountId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + if (enrollmentAccountId == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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(queryOptions); + String apply = null; + if (queryOptions != null) { + apply = queryOptions.apply(); + } + return service.listForBillingPeriodByEnrollmentAccount(enrollmentAccountId, billingPeriodName, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByEnrollmentAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByEnrollmentAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByManagementGroup(final String managementGroupId) { + ServiceResponse> response = listByManagementGroupSinglePageAsync(managementGroupId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group 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> listByManagementGroupAsync(final String managementGroupId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupSinglePageAsync(managementGroupId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listByManagementGroupAsync(final String managementGroupId) { + return listByManagementGroupWithServiceResponseAsync(managementGroupId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listByManagementGroupWithServiceResponseAsync(final String managementGroupId) { + return listByManagementGroupSinglePageAsync(managementGroupId) + .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(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupSinglePageAsync(final String managementGroupId) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId 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 expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final QueryOptions queryOptions = null; + String apply = null; + return service.listByManagementGroup(managementGroupId, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByManagementGroup(final String managementGroupId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + ServiceResponse> response = listByManagementGroupSinglePageAsync(managementGroupId, expand, filter, skiptoken, top, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @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> listByManagementGroupAsync(final String managementGroupId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupSinglePageAsync(managementGroupId, expand, filter, skiptoken, top, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listByManagementGroupAsync(final String managementGroupId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listByManagementGroupWithServiceResponseAsync(managementGroupId, expand, filter, skiptoken, top, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listByManagementGroupWithServiceResponseAsync(final String managementGroupId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listByManagementGroupSinglePageAsync(managementGroupId, expand, filter, skiptoken, top, queryOptions) + .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(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param managementGroupId Azure Management Group ID. + ServiceResponse> * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + ServiceResponse> * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName, properties/instanceId or tags. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupSinglePageAsync(final String managementGroupId, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId 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(queryOptions); + String apply = null; + if (queryOptions != null) { + apply = queryOptions.apply(); + } + return service.listByManagementGroup(managementGroupId, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByManagementGroup(final String managementGroupId, final String billingPeriodName) { + ServiceResponse> response = listForBillingPeriodByManagementGroupSinglePageAsync(managementGroupId, billingPeriodName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @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> listForBillingPeriodByManagementGroupAsync(final String managementGroupId, final String billingPeriodName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByManagementGroupSinglePageAsync(managementGroupId, billingPeriodName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByManagementGroupAsync(final String managementGroupId, final String billingPeriodName) { + return listForBillingPeriodByManagementGroupWithServiceResponseAsync(managementGroupId, billingPeriodName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByManagementGroupWithServiceResponseAsync(final String managementGroupId, final String billingPeriodName) { + return listForBillingPeriodByManagementGroupSinglePageAsync(managementGroupId, billingPeriodName) + .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(listForBillingPeriodByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByManagementGroupSinglePageAsync(final String managementGroupId, final String billingPeriodName) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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 expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + final QueryOptions queryOptions = null; + String apply = null; + return service.listForBillingPeriodByManagementGroup(managementGroupId, billingPeriodName, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByManagementGroup(final String managementGroupId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + ServiceResponse> response = listForBillingPeriodByManagementGroupSinglePageAsync(managementGroupId, billingPeriodName, expand, filter, skiptoken, top, queryOptions).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @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> listForBillingPeriodByManagementGroupAsync(final String managementGroupId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByManagementGroupSinglePageAsync(managementGroupId, billingPeriodName, expand, filter, skiptoken, top, queryOptions), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByManagementGroupAsync(final String managementGroupId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listForBillingPeriodByManagementGroupWithServiceResponseAsync(managementGroupId, billingPeriodName, expand, filter, skiptoken, top, queryOptions) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param managementGroupId Azure Management Group ID. + * @param billingPeriodName Billing Period Name. + * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N usageDetails. + * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByManagementGroupWithServiceResponseAsync(final String managementGroupId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + return listForBillingPeriodByManagementGroupSinglePageAsync(managementGroupId, billingPeriodName, expand, filter, skiptoken, top, queryOptions) + .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(listForBillingPeriodByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param managementGroupId Azure Management Group ID. + ServiceResponse> * @param billingPeriodName Billing Period Name. + ServiceResponse> * @param expand May be used to expand the properties/additionalProperties or properties/meterDetails within a list of usage details. By default, these fields are not included when listing usage details. + ServiceResponse> * @param filter May be used to filter usageDetails by properties/usageEnd (Utc time), properties/usageStart (Utc time), properties/resourceGroup, properties/instanceName or properties/instanceId. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N usageDetails. + ServiceResponse> * @param queryOptions Additional parameters for the operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByManagementGroupSinglePageAsync(final String managementGroupId, final String billingPeriodName, final String expand, final String filter, final String skiptoken, final Integer top, final QueryOptions queryOptions) { + if (managementGroupId == null) { + throw new IllegalArgumentException("Parameter managementGroupId is required and cannot be null."); + } + if (billingPeriodName == null) { + throw new IllegalArgumentException("Parameter billingPeriodName 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(queryOptions); + String apply = null; + if (queryOptions != null) { + apply = queryOptions.apply(); + } + return service.listForBillingPeriodByManagementGroup(managementGroupId, billingPeriodName, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), apply, this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByManagementGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByManagementGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> 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 the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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 the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> 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 the usage details for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByBillingPeriodNext(final String nextPageLink) { + ServiceResponse> response = listByBillingPeriodNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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> listByBillingPeriodNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingPeriodNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable> listByBillingPeriodNextAsync(final String nextPageLink) { + return listByBillingPeriodNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable>> listByBillingPeriodNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingPeriodNextSinglePageAsync(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(listByBillingPeriodNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingPeriodNextSinglePageAsync(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.listByBillingPeriodNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingPeriodNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingPeriodNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(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(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details by billingAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(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.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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> listForBillingPeriodByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByBillingAccountNextAsync(final String nextPageLink) { + return listForBillingPeriodByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listForBillingPeriodByBillingAccountNextSinglePageAsync(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(listForBillingPeriodByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details based on billingAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByBillingAccountNextSinglePageAsync(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.listForBillingPeriodByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByDepartmentNext(final String nextPageLink) { + ServiceResponse> response = listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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> listByDepartmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable> listByDepartmentNextAsync(final String nextPageLink) { + return listByDepartmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable>> listByDepartmentNextWithServiceResponseAsync(final String nextPageLink) { + return listByDepartmentNextSinglePageAsync(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(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details by departmentId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentNextSinglePageAsync(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.listByDepartmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDepartmentNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByDepartmentNext(final String nextPageLink) { + ServiceResponse> response = listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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> listForBillingPeriodByDepartmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByDepartmentNextAsync(final String nextPageLink) { + return listForBillingPeriodByDepartmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByDepartmentNextWithServiceResponseAsync(final String nextPageLink) { + return listForBillingPeriodByDepartmentNextSinglePageAsync(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(listForBillingPeriodByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details based on departmentId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByDepartmentNextSinglePageAsync(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.listForBillingPeriodByDepartmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByDepartmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByDepartmentNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByEnrollmentAccountNext(final String nextPageLink) { + ServiceResponse> response = listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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> listByEnrollmentAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable> listByEnrollmentAccountNextAsync(final String nextPageLink) { + return listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable>> listByEnrollmentAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(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(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details by enrollmentAccountId for a scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountNextSinglePageAsync(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.listByEnrollmentAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEnrollmentAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByEnrollmentAccountNext(final String nextPageLink) { + ServiceResponse> response = listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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> listForBillingPeriodByEnrollmentAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByEnrollmentAccountNextAsync(final String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByEnrollmentAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(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(listForBillingPeriodByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage details based on enrollmentAccountId for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByEnrollmentAccountNextSinglePageAsync(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.listForBillingPeriodByEnrollmentAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByEnrollmentAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByEnrollmentAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listByManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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> listByManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable> listByManagementGroupNextAsync(final String nextPageLink) { + return listByManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable>> listByManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByManagementGroupNextSinglePageAsync(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(listByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by current billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByManagementGroupNextSinglePageAsync(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.listByManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByManagementGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<UsageDetailInner> object if successful. + */ + public PagedList listForBillingPeriodByManagementGroupNext(final String nextPageLink) { + ServiceResponse> response = listForBillingPeriodByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listForBillingPeriodByManagementGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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> listForBillingPeriodByManagementGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listForBillingPeriodByManagementGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listForBillingPeriodByManagementGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable> listForBillingPeriodByManagementGroupNextAsync(final String nextPageLink) { + return listForBillingPeriodByManagementGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @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<UsageDetailInner> object + */ + public Observable>> listForBillingPeriodByManagementGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listForBillingPeriodByManagementGroupNextSinglePageAsync(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(listForBillingPeriodByManagementGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the usage detail records for all subscriptions belonging to a management group scope by specified billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listForBillingPeriodByManagementGroupNextSinglePageAsync(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.listForBillingPeriodByManagementGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listForBillingPeriodByManagementGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listForBillingPeriodByManagementGroupNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/package-info.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/implementation/package-info.java new file mode 100644 index 0000000000000..fe709164e8e32 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/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 ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2018_06_30.implementation; diff --git a/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/package-info.java b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/package-info.java new file mode 100644 index 0000000000000..9c9e47de9142b --- /dev/null +++ b/sdk/consumption/mgmt-v2018_06_30/src/main/java/com/microsoft/azure/management/consumption/v2018_06_30/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 ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2018_06_30;