From 0d8ef7ca6b150be3ce379113c4ab4615a7d3ccd0 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 26 Mar 2020 07:04:50 +0000 Subject: [PATCH] Generated from fdbac24ea18c0fc65013cf5fce1966319867f508 Corrected filter property properties/resourceId properties/resourceId is not a valid filter property for this endpoint. When attempting to filter on resourceId "properties/resourceId eq '{resourceId}'" returns results for the entire scope. However using "properties/instanceId eq '{resourceId}'" returns data only for the specified resourceId. --- sdk/consumption/mgmt-v2018_05_31/pom.xml | 135 + .../consumption/v2018_05_31/Bound.java | 41 + .../consumption/v2018_05_31/ChargeType.java | 41 + .../consumption/v2018_05_31/ErrorDetails.java | 47 + .../v2018_05_31/ErrorResponse.java | 44 + .../v2018_05_31/ErrorResponseException.java | 44 + .../consumption/v2018_05_31/Forecast.java | 73 + ...orecastPropertiesConfidenceLevelsItem.java | 75 + .../consumption/v2018_05_31/Forecasts.java | 19 + .../consumption/v2018_05_31/Grain.java | 44 + .../consumption/v2018_05_31/MeterDetails.java | 126 + .../consumption/v2018_05_31/Operation.java | 30 + .../v2018_05_31/OperationDisplay.java | 62 + .../consumption/v2018_05_31/Operations.java | 27 + .../v2018_05_31/PriceSheetProperties.java | 155 + .../v2018_05_31/PriceSheetResult.java | 52 + .../consumption/v2018_05_31/PriceSheets.java | 36 + .../consumption/v2018_05_31/QueryOptions.java | 44 + .../consumption/v2018_05_31/UsageDetail.java | 174 + .../consumption/v2018_05_31/UsageDetails.java | 91 + .../ConsumptionManagementClientImpl.java | 238 ++ .../implementation/ConsumptionManager.java | 135 + .../implementation/ForecastImpl.java | 87 + .../implementation/ForecastInner.java | 156 + .../implementation/ForecastsImpl.java | 68 + .../implementation/ForecastsInner.java | 223 ++ .../implementation/IdParsingUtils.java | 57 + .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 59 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 ++ .../v2018_05_31/implementation/PageImpl.java | 75 + .../v2018_05_31/implementation/PageImpl1.java | 75 + .../implementation/PriceSheetResultImpl.java | 59 + .../implementation/PriceSheetResultInner.java | 68 + .../implementation/PriceSheetsImpl.java | 54 + .../implementation/PriceSheetsInner.java | 382 ++ .../implementation/UsageDetailImpl.java | 181 + .../implementation/UsageDetailInner.java | 433 +++ .../implementation/UsageDetailsImpl.java | 175 + .../implementation/UsageDetailsInner.java | 3083 +++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2018_05_31/package-info.java | 11 + 43 files changed, 7359 insertions(+) create mode 100644 sdk/consumption/mgmt-v2018_05_31/pom.xml create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Bound.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ChargeType.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ErrorDetails.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ErrorResponse.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ErrorResponseException.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Forecast.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ForecastPropertiesConfidenceLevelsItem.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Forecasts.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Grain.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/MeterDetails.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Operation.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/OperationDisplay.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Operations.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/PriceSheetProperties.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/PriceSheetResult.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/PriceSheets.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/QueryOptions.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/UsageDetail.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/UsageDetails.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ConsumptionManagementClientImpl.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ConsumptionManager.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastImpl.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastInner.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastsInner.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/IdParsingUtils.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationImpl.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationInner.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationsInner.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PageImpl.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PageImpl1.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetResultImpl.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetResultInner.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetsInner.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailImpl.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailInner.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailsImpl.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailsInner.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/package-info.java create mode 100644 sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/package-info.java diff --git a/sdk/consumption/mgmt-v2018_05_31/pom.xml b/sdk/consumption/mgmt-v2018_05_31/pom.xml new file mode 100644 index 0000000000000..40e9fa2d33b38 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2018_05_31 + + 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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Bound.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Bound.java new file mode 100644 index 0000000000000..c4b7c22f2da07 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ChargeType.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ChargeType.java new file mode 100644 index 0000000000000..dab763d876ec3 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ErrorDetails.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ErrorDetails.java new file mode 100644 index 0000000000000..b33ba422a4d34 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ErrorResponse.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ErrorResponse.java new file mode 100644 index 0000000000000..c3635c76ab8f2 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ErrorResponseException.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ErrorResponseException.java new file mode 100644 index 0000000000000..bc19954fdb6b0 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Forecast.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Forecast.java new file mode 100644 index 0000000000000..01e1e0a8c50c0 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.consumption.v2018_05_31.implementation.ForecastInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ForecastPropertiesConfidenceLevelsItem.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/ForecastPropertiesConfidenceLevelsItem.java new file mode 100644 index 0000000000000..b15d1f79c168c --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Forecasts.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Forecasts.java new file mode 100644 index 0000000000000..9bd2692abb39a --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Grain.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Grain.java new file mode 100644 index 0000000000000..d89357fb21a0e --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/MeterDetails.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/MeterDetails.java new file mode 100644 index 0000000000000..8ef8b3a554ca4 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/MeterDetails.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_05_31; + +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; + + /** + * 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; + } + +} diff --git a/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Operation.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Operation.java new file mode 100644 index 0000000000000..b0e309fe51618 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_05_31.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/OperationDisplay.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/OperationDisplay.java new file mode 100644 index 0000000000000..6cbe3808876af --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Operations.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Operations.java new file mode 100644 index 0000000000000..d37d6e6ce55d4 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2018_05_31; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/PriceSheetProperties.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/PriceSheetProperties.java new file mode 100644 index 0000000000000..ff4f4cd94fcc0 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/PriceSheetResult.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/PriceSheetResult.java new file mode 100644 index 0000000000000..ff0069ce5c125 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_05_31.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/PriceSheets.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/PriceSheets.java new file mode 100644 index 0000000000000..3c3d380de5335 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/QueryOptions.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/QueryOptions.java new file mode 100644 index 0000000000000..e92297d3d80ca --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31; + +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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/UsageDetail.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/UsageDetail.java new file mode 100644 index 0000000000000..886ccc46a3ec6 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/UsageDetail.java @@ -0,0 +1,174 @@ +/** + * 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_05_31; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2018_05_31.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2018_05_31.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 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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/UsageDetails.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/UsageDetails.java new file mode 100644 index 0000000000000..96ab68996091d --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/UsageDetails.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_05_31; + +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 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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ConsumptionManagementClientImpl.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 0000000000000..15044f261a479 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ConsumptionManagementClientImpl.java @@ -0,0 +1,238 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2018_05_31.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the 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-05-31. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2018-05-31. + * + * @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 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 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 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; + } + + /** + * 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-05-31"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.priceSheets = new PriceSheetsInner(restClient().retrofit(), this); + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.forecasts = new ForecastsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(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-05-31"); + } +} diff --git a/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ConsumptionManager.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ConsumptionManager.java new file mode 100644 index 0000000000000..d2c066b5cfee5 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ConsumptionManager.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2018_05_31.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2018_05_31.PriceSheets; +import com.microsoft.azure.management.consumption.v2018_05_31.UsageDetails; +import com.microsoft.azure.management.consumption.v2018_05_31.Forecasts; +import com.microsoft.azure.management.consumption.v2018_05_31.Operations; +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 PriceSheets priceSheets; + private UsageDetails usageDetails; + private Forecasts forecasts; + private Operations operations; + /** + * 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 PriceSheets. + */ + public PriceSheets priceSheets() { + if (this.priceSheets == null) { + this.priceSheets = new PriceSheetsImpl(this); + } + return this.priceSheets; + } + + /** + * @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 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; + } + + /** + * 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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastImpl.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastImpl.java new file mode 100644 index 0000000000000..d776224cb8ced --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31.implementation; + +import com.microsoft.azure.management.consumption.v2018_05_31.Forecast; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2018_05_31.ChargeType; +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_05_31.ForecastPropertiesConfidenceLevelsItem; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastInner.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastInner.java new file mode 100644 index 0000000000000..eda4e2f572057 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31.implementation; + +import com.microsoft.azure.management.consumption.v2018_05_31.Grain; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2018_05_31.ChargeType; +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastsImpl.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastsImpl.java new file mode 100644 index 0000000000000..3baceb7c74914 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastsInner.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/ForecastsInner.java new file mode 100644 index 0000000000000..6c1d734f89491 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/IdParsingUtils.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..ff6b2b73045d8 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2018_05_31.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationImpl.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationImpl.java new file mode 100644 index 0000000000000..a76f6a4d717e4 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31.implementation; + +import com.microsoft.azure.management.consumption.v2018_05_31.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationInner.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationInner.java new file mode 100644 index 0000000000000..e8edb286fc05f --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31.implementation; + +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationsImpl.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..745fe92e9b21a --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2018_05_31.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_05_31.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationsInner.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationsInner.java new file mode 100644 index 0000000000000..064eea1fec47b --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2018_05_31.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_05_31.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_05_31.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_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PageImpl.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PageImpl.java new file mode 100644 index 0000000000000..0d48fb6a535bb --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2018_05_31.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PageImpl1.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PageImpl1.java new file mode 100644 index 0000000000000..ac170168db2de --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2018_05_31.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetResultImpl.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetResultImpl.java new file mode 100644 index 0000000000000..b12693c8d90d4 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31.implementation; + +import com.microsoft.azure.management.consumption.v2018_05_31.PriceSheetResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetResultInner.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetResultInner.java new file mode 100644 index 0000000000000..2979d65ea0d52 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31.implementation; + +import java.util.List; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetsImpl.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetsImpl.java new file mode 100644 index 0000000000000..b48a8a9723d69 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_05_31.PriceSheets; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetsInner.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/PriceSheetsInner.java new file mode 100644 index 0000000000000..46be203c6252a --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/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_05_31.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31.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_05_31.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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailImpl.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailImpl.java new file mode 100644 index 0000000000000..313088d842029 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailImpl.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_05_31.implementation; + +import com.microsoft.azure.management.consumption.v2018_05_31.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2018_05_31.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 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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailInner.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailInner.java new file mode 100644 index 0000000000000..881de774df3a0 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailInner.java @@ -0,0 +1,433 @@ +/** + * 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_05_31.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import java.util.UUID; +import com.microsoft.azure.management.consumption.v2018_05_31.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; + + /** + * 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 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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailsImpl.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailsImpl.java new file mode 100644 index 0000000000000..e4338e869b9d7 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailsImpl.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_05_31.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2018_05_31.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2018_05_31.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 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_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailsInner.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailsInner.java new file mode 100644 index 0000000000000..063098eecbb25 --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/UsageDetailsInner.java @@ -0,0 +1,3083 @@ +/** + * 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_05_31.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_05_31.ErrorResponseException; +import com.microsoft.azure.management.consumption.v2018_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.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_05_31.UsageDetails listForBillingPeriodByEnrollmentAccountNext" }) + @GET + Observable> listForBillingPeriodByEnrollmentAccountNext(@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 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); + } + +} diff --git a/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/package-info.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/package-info.java new file mode 100644 index 0000000000000..f6277ad862bcc --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2018_05_31.implementation; diff --git a/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/package-info.java b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/package-info.java new file mode 100644 index 0000000000000..6943509e9455b --- /dev/null +++ b/sdk/consumption/mgmt-v2018_05_31/src/main/java/com/microsoft/azure/management/consumption/v2018_05_31/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2018_05_31;