From 02df32cce7a2d81ec8a61a55e926a0456d5a84ef Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 01/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From f3daf4e9d87c45f8fd9c336fad9b93804c210d2d Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 02/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From bb982572c4b776064213b45648393bb0e99c30d9 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 03/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From 2b03925f0b282c37e733e26df8ffb797c0aff4a1 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 04/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From 4575d35132f670846ce58eb69e910d2c1601f9cc Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 05/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From e7ad36c8872fd411cb95633c8131fa11f135b225 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 06/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../storage/blob/BlobServiceAsyncClient.java | 35 +++---- .../azure/storage/blob/BlobServiceClient.java | 19 ++-- .../blob/implementation/BlobsImpl.java | 2 +- .../blob/implementation/DirectorysImpl.java | 2 +- .../blob/implementation/ServicesImpl.java | 28 +++--- ...sponse.java => BlobContainersSegment.java} | 86 ++++++++--------- .../models/ListBlobsFlatSegmentResponse.java | 26 ----- ...viceListBlobContainersSegmentHeaders.java} | 22 ++--- .../models/ServicesGetPropertiesResponse.java | 8 +- ...cesListBlobContainersSegmentResponse.java} | 12 +-- .../blob/models/BlobContainerItem.java | 6 +- .../blob/models/BlobContainerProperties.java | 18 ++-- ...erties.java => BlobServiceProperties.java} | 30 +++--- .../models/ListBlobContainersIncludeType.java | 8 +- ...ServiceAsyncClientJavaDocCodeSnippets.java | 19 ++-- .../BlobServiceClientJavaDocCodeSnippets.java | 23 ++--- .../com/azure/storage/blob/APISpec.groovy | 6 +- .../azure/storage/blob/ServiceAPITest.groovy | 16 ++-- .../azure-storage-blob/swagger/README.md | 96 ++++++++++++++++--- 19 files changed, 254 insertions(+), 208 deletions(-) rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/{ListContainersSegmentResponse.java => BlobContainersSegment.java} (67%) rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/{ServiceListContainersSegmentHeaders.java => ServiceListBlobContainersSegmentHeaders.java} (80%) rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/{ServicesListContainersSegmentResponse.java => ServicesListBlobContainersSegmentResponse.java} (60%) rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/{StorageServiceProperties.java => BlobServiceProperties.java} (84%) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index 6746e5d14043..e112a9c30666 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -3,9 +3,6 @@ package com.azure.storage.blob; -import static com.azure.core.implementation.util.FluxUtil.withContext; -import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse; - import com.azure.core.annotation.ServiceClient; import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpPipeline; @@ -19,22 +16,26 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.implementation.models.ServicesListContainersSegmentResponse; +import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse; import com.azure.storage.blob.models.BlobContainerItem; +import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; -import com.azure.storage.blob.models.StorageServiceProperties; import com.azure.storage.blob.models.StorageServiceStats; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Utility; +import reactor.core.publisher.Mono; + import java.time.Duration; import java.time.OffsetDateTime; import java.util.Map; import java.util.function.Function; -import reactor.core.publisher.Mono; + +import static com.azure.core.implementation.util.FluxUtil.withContext; +import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse; /** * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does @@ -234,19 +235,19 @@ PagedFlux listBlobContainersWithOptionalTimeout(ListBlobConta response.getRequest(), response.getStatusCode(), response.getHeaders(), - response.getValue().getContainerItems(), + response.getValue().getBlobContainerItems(), response.getValue().getNextMarker(), response.getDeserializedHeaders())); return new PagedFlux<>(() -> func.apply(null), func); } - private Mono listBlobContainersSegment(String marker, + private Mono listBlobContainersSegment(String marker, ListBlobContainersOptions options, Duration timeout) { options = options == null ? new ListBlobContainersOptions() : options; return postProcessResponse(Utility.applyOptionalTimeout( - this.azureBlobStorage.services().listContainersSegmentWithRestResponseAsync( + this.azureBlobStorage.services().listBlobContainersSegmentWithRestResponseAsync( options.getPrefix(), marker, options.getMaxResults(), options.getDetails().toIncludeType(), null, null, Context.NONE), timeout)); } @@ -261,7 +262,7 @@ private Mono listBlobContainersSegment(St * * @return A reactive response containing the storage account properties. */ - public Mono getProperties() { + public Mono getProperties() { return getPropertiesWithResponse().flatMap(FluxUtil::toMono); } @@ -276,11 +277,11 @@ public Mono getProperties() { * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the storage * account properties. */ - public Mono> getPropertiesWithResponse() { + public Mono> getPropertiesWithResponse() { return withContext(this::getPropertiesWithResponse); } - Mono> getPropertiesWithResponse(Context context) { + Mono> getPropertiesWithResponse(Context context) { return postProcessResponse( this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, rb.getValue())); @@ -294,12 +295,12 @@ Mono> getPropertiesWithResponse(Context conte * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setProperties#StorageServiceProperties} + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setProperties#BlobServiceProperties} * * @param properties Configures the service. * @return A {@link Mono} containing the storage account properties. */ - public Mono setProperties(StorageServiceProperties properties) { + public Mono setProperties(BlobServiceProperties properties) { return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); } @@ -310,16 +311,16 @@ public Mono setProperties(StorageServiceProperties properties) { * sets the version header on each request, overriding the default. *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#StorageServiceProperties} + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#BlobServiceProperties} * * @param properties Configures the service. * @return A {@link Mono} containing the storage account properties. */ - public Mono> setPropertiesWithResponse(StorageServiceProperties properties) { + public Mono> setPropertiesWithResponse(BlobServiceProperties properties) { return withContext(context -> setPropertiesWithResponse(properties, context)); } - Mono> setPropertiesWithResponse(StorageServiceProperties properties, Context context) { + Mono> setPropertiesWithResponse(BlobServiceProperties properties, Context context) { return postProcessResponse( this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context)) .map(response -> new SimpleResponse<>(response, null)); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index 761f2691a8cc..e1521dc1b0a7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -11,17 +11,18 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobContainerItem; +import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; -import com.azure.storage.blob.models.StorageServiceProperties; import com.azure.storage.blob.models.StorageServiceStats; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Utility; +import reactor.core.publisher.Mono; + import java.time.Duration; import java.time.OffsetDateTime; import java.util.Map; -import reactor.core.publisher.Mono; /** * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does @@ -191,7 +192,7 @@ public PagedIterable listBlobContainers(ListBlobContainersOpt * * @return The storage account properties. */ - public StorageServiceProperties getProperties() { + public BlobServiceProperties getProperties() { return getPropertiesWithResponse(null, Context.NONE).getValue(); } @@ -207,9 +208,9 @@ public StorageServiceProperties getProperties() { * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link Response} whose {@link Response#getValue() value} contains the storage account properties. */ - public Response getPropertiesWithResponse(Duration timeout, Context context) { + public Response getPropertiesWithResponse(Duration timeout, Context context) { - Mono> response = blobServiceAsyncClient.getPropertiesWithResponse(context); + Mono> response = blobServiceAsyncClient.getPropertiesWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -222,11 +223,11 @@ public Response getPropertiesWithResponse(Duration tim * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobServiceClient.setProperties#StorageServiceProperties} + * {@codesnippet com.azure.storage.blob.BlobServiceClient.setProperties#BlobServiceProperties} * * @param properties Configures the service. */ - public void setProperties(StorageServiceProperties properties) { + public void setProperties(BlobServiceProperties properties) { setPropertiesWithResponse(properties, null, Context.NONE); } @@ -238,14 +239,14 @@ public void setProperties(StorageServiceProperties properties) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#StorageServiceProperties-Duration-Context} + * {@codesnippet com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#BlobServiceProperties-Duration-Context} * * @param properties Configures the service. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @param context Additional context that is passed through the Http pipeline during the service call. * @return The storage account properties. */ - public Response setPropertiesWithResponse(StorageServiceProperties properties, Duration timeout, + public Response setPropertiesWithResponse(BlobServiceProperties properties, Duration timeout, Context context) { Mono> response = blobServiceAsyncClient.setPropertiesWithResponse(properties, context); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java index 5626195f0321..391fd548e2b9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java @@ -43,11 +43,11 @@ import com.azure.storage.blob.implementation.models.BlobsSetTierResponse; import com.azure.storage.blob.implementation.models.BlobsStartCopyFromURLResponse; import com.azure.storage.blob.implementation.models.BlobsUndeleteResponse; +import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException; import com.azure.storage.blob.implementation.models.DirectoryHttpHeaders; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.CpkInfo; -import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; import com.azure.storage.blob.models.EncryptionAlgorithmType; import com.azure.storage.blob.models.LeaseAccessConditions; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java index e26340bd8079..f50c46ed2342 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java @@ -21,13 +21,13 @@ import com.azure.core.implementation.DateTimeRfc1123; import com.azure.core.implementation.RestProxy; import com.azure.core.util.Context; +import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException; import com.azure.storage.blob.implementation.models.DirectoryHttpHeaders; import com.azure.storage.blob.implementation.models.DirectorysCreateResponse; import com.azure.storage.blob.implementation.models.DirectorysDeleteResponse; import com.azure.storage.blob.implementation.models.DirectorysGetAccessControlResponse; import com.azure.storage.blob.implementation.models.DirectorysRenameResponse; import com.azure.storage.blob.implementation.models.DirectorysSetAccessControlResponse; -import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ModifiedAccessConditions; import com.azure.storage.blob.models.PathRenameMode; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index ce6e74808c29..c2b7614087fd 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -23,13 +23,13 @@ import com.azure.storage.blob.implementation.models.ServicesGetPropertiesResponse; import com.azure.storage.blob.implementation.models.ServicesGetStatisticsResponse; import com.azure.storage.blob.implementation.models.ServicesGetUserDelegationKeyResponse; -import com.azure.storage.blob.implementation.models.ServicesListContainersSegmentResponse; +import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse; import com.azure.storage.blob.implementation.models.ServicesSetPropertiesResponse; import com.azure.storage.blob.implementation.models.ServicesSubmitBatchResponse; +import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersIncludeType; import com.azure.storage.blob.models.StorageErrorException; -import com.azure.storage.blob.models.StorageServiceProperties; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -70,7 +70,7 @@ private interface ServicesService { @Put("") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") StorageServiceProperties storageServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") BlobServiceProperties blobServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @Get("") @ExpectedResponses({200}) @@ -85,7 +85,7 @@ private interface ServicesService { @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListBlobContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); + Mono listBlobContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListBlobContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); @Post("") @ExpectedResponses({200}) @@ -106,24 +106,24 @@ private interface ServicesService { /** * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. * - * @param storageServiceProperties The StorageService properties. + * @param blobServiceProperties The StorageService properties. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Context context) { + public Mono setPropertiesWithRestResponseAsync(BlobServiceProperties blobServiceProperties, Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); + return service.setProperties(this.client.getUrl(), blobServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. * - * @param storageServiceProperties The StorageService properties. + * @param blobServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. @@ -131,10 +131,10 @@ public Mono setPropertiesWithRestResponseAsync(St * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Integer timeout, String requestId, Context context) { + public Mono setPropertiesWithRestResponseAsync(BlobServiceProperties blobServiceProperties, Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); + return service.setProperties(this.client.getUrl(), blobServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -209,7 +209,7 @@ public Mono getStatisticsWithRestResponseAsync(In * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono listContainersSegmentWithRestResponseAsync(Context context) { + public Mono listBlobContainersSegmentWithRestResponseAsync(Context context) { final String prefix = null; final String marker = null; final Integer maxresults = null; @@ -217,7 +217,7 @@ public Mono listContainersSegmentWithRest final Integer timeout = null; final String requestId = null; final String comp = "list"; - return service.listContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); + return service.listBlobContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); } /** @@ -234,9 +234,9 @@ public Mono listContainersSegmentWithRest * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono listContainersSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, ListBlobContainersIncludeType include, Integer timeout, String requestId, Context context) { + public Mono listBlobContainersSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, ListBlobContainersIncludeType include, Integer timeout, String requestId, Context context) { final String comp = "list"; - return service.listContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); + return service.listBlobContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); } /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListContainersSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobContainersSegment.java similarity index 67% rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListContainersSegmentResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobContainersSegment.java index 21c76df8dde3..6c3e9d25558b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListContainersSegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobContainersSegment.java @@ -18,7 +18,7 @@ */ @JacksonXmlRootElement(localName = "EnumerationResults") @Fluent -public final class ListContainersSegmentResponse { +public final class BlobContainersSegment { /* * The serviceEndpoint property. */ @@ -28,7 +28,7 @@ public final class ListContainersSegmentResponse { /* * The prefix property. */ - @JsonProperty(value = "Prefix", required = true) + @JsonProperty(value = "Prefix") private String prefix; /* @@ -40,8 +40,14 @@ public final class ListContainersSegmentResponse { /* * The maxResults property. */ - @JsonProperty(value = "MaxResults", required = true) - private int maxResults; + @JsonProperty(value = "MaxResults") + private Integer maxResults; + + /* + * The nextMarker property. + */ + @JsonProperty(value = "NextMarker", required = true) + private String nextMarker; private static final class ContainersWrapper { @JacksonXmlProperty(localName = "Container") @@ -54,16 +60,10 @@ private ContainersWrapper(@JacksonXmlProperty(localName = "Container") List getContainerItems() { - if (this.containerItems == null) { - this.containerItems = new ContainersWrapper(new ArrayList()); - } - return this.containerItems.items; + public String getNextMarker() { + return this.nextMarker; } /** - * Set the containerItems property: The containerItems property. + * Set the nextMarker property: The nextMarker property. * - * @param blobContainerItems the containerItems value to set. - * @return the ListContainersSegmentResponse object itself. + * @param nextMarker the nextMarker value to set. + * @return the BlobContainersSegment object itself. */ - public ListContainersSegmentResponse setContainerItems(List blobContainerItems) { - this.containerItems = new ContainersWrapper(blobContainerItems); + public BlobContainersSegment setNextMarker(String nextMarker) { + this.nextMarker = nextMarker; return this; } /** - * Get the nextMarker property: The nextMarker property. + * Get the blobContainerItems property: The blobContainerItems property. * - * @return the nextMarker value. + * @return the blobContainerItems value. */ - public String getNextMarker() { - return this.nextMarker; + public List getBlobContainerItems() { + if (this.blobContainerItems == null) { + this.blobContainerItems = new ContainersWrapper(new ArrayList()); + } + return this.blobContainerItems.items; } /** - * Set the nextMarker property: The nextMarker property. + * Set the blobContainerItems property: The blobContainerItems property. * - * @param nextMarker the nextMarker value to set. - * @return the ListContainersSegmentResponse object itself. + * @param blobContainerItems the blobContainerItems value to set. + * @return the BlobContainersSegment object itself. */ - public ListContainersSegmentResponse setNextMarker(String nextMarker) { - this.nextMarker = nextMarker; + public BlobContainersSegment setBlobContainerItems(List blobContainerItems) { + this.blobContainerItems = new ContainersWrapper(blobContainerItems); return this; } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListBlobsFlatSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListBlobsFlatSegmentResponse.java index 3991764e4670..09a93450c0e4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListBlobsFlatSegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListBlobsFlatSegmentResponse.java @@ -45,12 +45,6 @@ public final class ListBlobsFlatSegmentResponse { @JsonProperty(value = "MaxResults", required = true) private int maxResults; - /* - * The delimiter property. - */ - @JsonProperty(value = "Delimiter", required = true) - private String delimiter; - /* * The segment property. */ @@ -163,26 +157,6 @@ public ListBlobsFlatSegmentResponse setMaxResults(int maxResults) { return this; } - /** - * Get the delimiter property: The delimiter property. - * - * @return the delimiter value. - */ - public String getDelimiter() { - return this.delimiter; - } - - /** - * Set the delimiter property: The delimiter property. - * - * @param delimiter the delimiter value to set. - * @return the ListBlobsFlatSegmentResponse object itself. - */ - public ListBlobsFlatSegmentResponse setDelimiter(String delimiter) { - this.delimiter = delimiter; - return this; - } - /** * Get the segment property: The segment property. * diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListContainersSegmentHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListBlobContainersSegmentHeaders.java similarity index 80% rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListContainersSegmentHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListBlobContainersSegmentHeaders.java index 9f73b4639d2e..6d402b18510f 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListContainersSegmentHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListBlobContainersSegmentHeaders.java @@ -9,11 +9,11 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; /** - * Defines headers for ListContainersSegment operation. + * Defines headers for ListBlobContainersSegment operation. */ -@JacksonXmlRootElement(localName = "Service-ListContainersSegment-Headers") +@JacksonXmlRootElement(localName = "Service-ListBlobContainersSegment-Headers") @Fluent -public final class ServiceListContainersSegmentHeaders { +public final class ServiceListBlobContainersSegmentHeaders { /* * If a client request id header is sent in the request, this header will * be present in the response with the same value. @@ -59,9 +59,9 @@ public String getClientRequestId() { * same value. * * @param clientRequestId the clientRequestId value to set. - * @return the ServiceListContainersSegmentHeaders object itself. + * @return the ServiceListBlobContainersSegmentHeaders object itself. */ - public ServiceListContainersSegmentHeaders setClientRequestId(String clientRequestId) { + public ServiceListBlobContainersSegmentHeaders setClientRequestId(String clientRequestId) { this.clientRequestId = clientRequestId; return this; } @@ -81,9 +81,9 @@ public String getRequestId() { * that was made and can be used for troubleshooting the request. * * @param requestId the requestId value to set. - * @return the ServiceListContainersSegmentHeaders object itself. + * @return the ServiceListBlobContainersSegmentHeaders object itself. */ - public ServiceListContainersSegmentHeaders setRequestId(String requestId) { + public ServiceListBlobContainersSegmentHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -105,9 +105,9 @@ public String getVersion() { * against version 2009-09-19 and above. * * @param version the version value to set. - * @return the ServiceListContainersSegmentHeaders object itself. + * @return the ServiceListBlobContainersSegmentHeaders object itself. */ - public ServiceListContainersSegmentHeaders setVersion(String version) { + public ServiceListBlobContainersSegmentHeaders setVersion(String version) { this.version = version; return this; } @@ -125,9 +125,9 @@ public String getErrorCode() { * Set the errorCode property: The errorCode property. * * @param errorCode the errorCode value to set. - * @return the ServiceListContainersSegmentHeaders object itself. + * @return the ServiceListBlobContainersSegmentHeaders object itself. */ - public ServiceListContainersSegmentHeaders setErrorCode(String errorCode) { + public ServiceListBlobContainersSegmentHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServicesGetPropertiesResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServicesGetPropertiesResponse.java index 8259f6c7629b..33d406d5ae58 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServicesGetPropertiesResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServicesGetPropertiesResponse.java @@ -7,12 +7,12 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; -import com.azure.storage.blob.models.StorageServiceProperties; +import com.azure.storage.blob.models.BlobServiceProperties; /** * Contains all response data for the getProperties operation. */ -public final class ServicesGetPropertiesResponse extends ResponseBase { +public final class ServicesGetPropertiesResponse extends ResponseBase { /** * Creates an instance of ServicesGetPropertiesResponse. * @@ -22,7 +22,7 @@ public final class ServicesGetPropertiesResponse extends ResponseBase { +public final class ServicesListBlobContainersSegmentResponse extends ResponseBase { /** - * Creates an instance of ServicesListContainersSegmentResponse. + * Creates an instance of ServicesListBlobContainersSegmentResponse. * - * @param request the request which resulted in this ServicesListContainersSegmentResponse. + * @param request the request which resulted in this ServicesListBlobContainersSegmentResponse. * @param statusCode the status code of the HTTP response. * @param rawHeaders the raw headers of the HTTP response. * @param value the deserialized value of the HTTP response. * @param headers the deserialized headers of the HTTP response. */ - public ServicesListContainersSegmentResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ListContainersSegmentResponse value, ServiceListContainersSegmentHeaders headers) { + public ServicesListBlobContainersSegmentResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, BlobContainersSegment value, ServiceListBlobContainersSegmentHeaders headers) { super(request, statusCode, rawHeaders, value, headers); } @@ -29,7 +29,7 @@ public ServicesListContainersSegmentResponse(HttpRequest request, int statusCode * @return the deserialized response body. */ @Override - public ListContainersSegmentResponse getValue() { + public BlobContainersSegment getValue() { return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItem.java index 075fe680dec7..28e75f1e2aa0 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItem.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItem.java @@ -46,7 +46,7 @@ public String getName() { * Set the name property: The name property. * * @param name the name value to set. - * @return the ContainerItem object itself. + * @return the BlobContainerItem object itself. */ public BlobContainerItem setName(String name) { this.name = name; @@ -66,7 +66,7 @@ public BlobContainerProperties getProperties() { * Set the properties property: The properties property. * * @param properties the properties value to set. - * @return the ContainerItem object itself. + * @return the BlobContainerItem object itself. */ public BlobContainerItem setProperties(BlobContainerProperties properties) { this.properties = properties; @@ -86,7 +86,7 @@ public Map getMetadata() { * Set the metadata property: The metadata property. * * @param metadata the metadata value to set. - * @return the ContainerItem object itself. + * @return the BlobContainerItem object itself. */ public BlobContainerItem setMetadata(Map metadata) { this.metadata = metadata; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerProperties.java index 9ce79fb00916..64160c276cc2 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerProperties.java @@ -13,7 +13,7 @@ /** * Properties of a container. */ -@JacksonXmlRootElement(localName = "ContainerProperties") +@JacksonXmlRootElement(localName = "BlobContainerProperties") @Fluent public final class BlobContainerProperties { /* @@ -81,7 +81,7 @@ public OffsetDateTime getLastModified() { * Set the lastModified property: The lastModified property. * * @param lastModified the lastModified value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { @@ -105,7 +105,7 @@ public String getEtag() { * Set the etag property: The etag property. * * @param etag the etag value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setEtag(String etag) { this.etag = etag; @@ -127,7 +127,7 @@ public LeaseStatusType getLeaseStatus() { * 'unlocked'. * * @param leaseStatus the leaseStatus value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; @@ -149,7 +149,7 @@ public LeaseStateType getLeaseState() { * 'leased', 'expired', 'breaking', 'broken'. * * @param leaseState the leaseState value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; @@ -171,7 +171,7 @@ public LeaseDurationType getLeaseDuration() { * 'fixed'. * * @param leaseDuration the leaseDuration value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; @@ -193,7 +193,7 @@ public PublicAccessType getPublicAccess() { * 'blob'. * * @param publicAccess the publicAccess value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setPublicAccess(PublicAccessType publicAccess) { this.publicAccess = publicAccess; @@ -215,7 +215,7 @@ public Boolean isHasImmutabilityPolicy() { * property. * * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setHasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { this.hasImmutabilityPolicy = hasImmutabilityPolicy; @@ -235,7 +235,7 @@ public Boolean isHasLegalHold() { * Set the hasLegalHold property: The hasLegalHold property. * * @param hasLegalHold the hasLegalHold value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setHasLegalHold(Boolean hasLegalHold) { this.hasLegalHold = hasLegalHold; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java similarity index 84% rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java index 6cf9ea619c36..254b6ea685be 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java @@ -17,7 +17,7 @@ */ @JacksonXmlRootElement(localName = "StorageServiceProperties") @Fluent -public final class StorageServiceProperties { +public final class BlobServiceProperties { /* * The logging property. */ @@ -85,9 +85,9 @@ public Logging getLogging() { * Set the logging property: The logging property. * * @param logging the logging value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setLogging(Logging logging) { + public BlobServiceProperties setLogging(Logging logging) { this.logging = logging; return this; } @@ -105,9 +105,9 @@ public Metrics getHourMetrics() { * Set the hourMetrics property: The hourMetrics property. * * @param hourMetrics the hourMetrics value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setHourMetrics(Metrics hourMetrics) { + public BlobServiceProperties setHourMetrics(Metrics hourMetrics) { this.hourMetrics = hourMetrics; return this; } @@ -125,9 +125,9 @@ public Metrics getMinuteMetrics() { * Set the minuteMetrics property: The minuteMetrics property. * * @param minuteMetrics the minuteMetrics value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setMinuteMetrics(Metrics minuteMetrics) { + public BlobServiceProperties setMinuteMetrics(Metrics minuteMetrics) { this.minuteMetrics = minuteMetrics; return this; } @@ -148,9 +148,9 @@ public List getCors() { * Set the cors property: The set of CORS rules. * * @param cors the cors value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setCors(List cors) { + public BlobServiceProperties setCors(List cors) { this.cors = new CorsWrapper(cors); return this; } @@ -174,9 +174,9 @@ public String getDefaultServiceVersion() { * recent versions. * * @param defaultServiceVersion the defaultServiceVersion value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setDefaultServiceVersion(String defaultServiceVersion) { + public BlobServiceProperties setDefaultServiceVersion(String defaultServiceVersion) { this.defaultServiceVersion = defaultServiceVersion; return this; } @@ -196,9 +196,9 @@ public RetentionPolicy getDeleteRetentionPolicy() { * property. * * @param deleteRetentionPolicy the deleteRetentionPolicy value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setDeleteRetentionPolicy(RetentionPolicy deleteRetentionPolicy) { + public BlobServiceProperties setDeleteRetentionPolicy(RetentionPolicy deleteRetentionPolicy) { this.deleteRetentionPolicy = deleteRetentionPolicy; return this; } @@ -216,9 +216,9 @@ public StaticWebsite getStaticWebsite() { * Set the staticWebsite property: The staticWebsite property. * * @param staticWebsite the staticWebsite value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setStaticWebsite(StaticWebsite staticWebsite) { + public BlobServiceProperties setStaticWebsite(StaticWebsite staticWebsite) { this.staticWebsite = staticWebsite; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobContainersIncludeType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobContainersIncludeType.java index dc7200e8b79b..03601bdcd962 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobContainersIncludeType.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobContainersIncludeType.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** - * Defines values for ListContainersIncludeType. + * Defines values for ListBlobContainersIncludeType. */ public enum ListBlobContainersIncludeType { /** @@ -17,7 +17,7 @@ public enum ListBlobContainersIncludeType { METADATA("metadata"); /** - * The actual serialized value for a ListContainersIncludeType instance. + * The actual serialized value for a ListBlobContainersIncludeType instance. */ private final String value; @@ -26,10 +26,10 @@ public enum ListBlobContainersIncludeType { } /** - * Parses a serialized value to a ListContainersIncludeType instance. + * Parses a serialized value to a ListBlobContainersIncludeType instance. * * @param value the serialized value to parse. - * @return the parsed ListContainersIncludeType object, or null if unable to parse. + * @return the parsed ListBlobContainersIncludeType object, or null if unable to parse. */ @JsonCreator public static ListBlobContainersIncludeType fromString(String value) { diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java index b5b7a22ead5b..417b87e53abd 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java @@ -5,12 +5,13 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobContainerListDetails; +import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.Logging; import com.azure.storage.blob.models.Metrics; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.RetentionPolicy; -import com.azure.storage.blob.models.StorageServiceProperties; + import java.time.OffsetDateTime; import java.util.Collections; import java.util.Map; @@ -119,14 +120,14 @@ public void getPropertiesWithResponse() { } /** - * Code snippet for {@link BlobServiceAsyncClient#setProperties(StorageServiceProperties)} + * Code snippet for {@link BlobServiceAsyncClient#setProperties(BlobServiceProperties)} */ public void setProperties() { - // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#StorageServiceProperties + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#BlobServiceProperties RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); - StorageServiceProperties properties = new StorageServiceProperties() + BlobServiceProperties properties = new BlobServiceProperties() .setLogging(new Logging() .setWrite(true) .setDelete(true) @@ -141,18 +142,18 @@ public void setProperties() { client.setProperties(properties).subscribe( response -> System.out.printf("Setting properties completed%n"), error -> System.out.printf("Setting properties failed: %s%n", error)); - // END: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#StorageServiceProperties + // END: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#BlobServiceProperties } /** - * Code snippet for {@link BlobServiceAsyncClient#setPropertiesWithResponse(StorageServiceProperties)} + * Code snippet for {@link BlobServiceAsyncClient#setPropertiesWithResponse(BlobServiceProperties)} */ public void setPropertiesWithResponse() { - // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#StorageServiceProperties + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#BlobServiceProperties RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); - StorageServiceProperties properties = new StorageServiceProperties() + BlobServiceProperties properties = new BlobServiceProperties() .setLogging(new Logging() .setWrite(true) .setDelete(true) @@ -166,7 +167,7 @@ public void setPropertiesWithResponse() { client.setPropertiesWithResponse(properties).subscribe(response -> System.out.printf("Setting properties completed with status %d%n", response.getStatusCode())); - // END: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#StorageServiceProperties + // END: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#BlobServiceProperties } /** diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java index 6c499f745c80..9c247a895441 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java @@ -5,13 +5,14 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobContainerListDetails; +import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.Logging; import com.azure.storage.blob.models.Metrics; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.RetentionPolicy; import com.azure.storage.blob.models.StorageAccountInfo; -import com.azure.storage.blob.models.StorageServiceProperties; + import java.time.Duration; import java.time.OffsetDateTime; import java.util.Collections; @@ -107,7 +108,7 @@ public void listContainers() { */ public void getProperties() { // BEGIN: com.azure.storage.blob.BlobServiceClient.getProperties - StorageServiceProperties properties = client.getProperties(); + BlobServiceProperties properties = client.getProperties(); System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b%n", properties.getHourMetrics().isEnabled(), @@ -121,7 +122,7 @@ public void getProperties() { public void getPropertiesWithResponse() { // BEGIN: com.azure.storage.blob.BlobServiceClient.getPropertiesWithResponse#Duration-Context Context context = new Context("Key", "Value"); - StorageServiceProperties properties = client.getPropertiesWithResponse(timeout, context).getValue(); + BlobServiceProperties properties = client.getPropertiesWithResponse(timeout, context).getValue(); System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b%n", properties.getHourMetrics().isEnabled(), @@ -130,14 +131,14 @@ public void getPropertiesWithResponse() { } /** - * Code snippet for {@link BlobServiceClient#setProperties(StorageServiceProperties)} + * Code snippet for {@link BlobServiceClient#setProperties(BlobServiceProperties)} */ public void setProperties() { - // BEGIN: com.azure.storage.blob.BlobServiceClient.setProperties#StorageServiceProperties + // BEGIN: com.azure.storage.blob.BlobServiceClient.setProperties#BlobServiceProperties RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); - StorageServiceProperties properties = new StorageServiceProperties() + BlobServiceProperties properties = new BlobServiceProperties() .setLogging(new Logging() .setWrite(true) .setDelete(true) @@ -155,18 +156,18 @@ public void setProperties() { } catch (UnsupportedOperationException error) { System.out.printf("Setting properties failed: %s%n", error); } - // END: com.azure.storage.blob.BlobServiceClient.setProperties#StorageServiceProperties + // END: com.azure.storage.blob.BlobServiceClient.setProperties#BlobServiceProperties } /** - * Code snippet for {@link BlobServiceClient#setPropertiesWithResponse(StorageServiceProperties, Duration, Context)} + * Code snippet for {@link BlobServiceClient#setPropertiesWithResponse(BlobServiceProperties, Duration, Context)} */ public void setPropertiesWithResponse() { - // BEGIN: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#StorageServiceProperties-Duration-Context + // BEGIN: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#BlobServiceProperties-Duration-Context RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); - StorageServiceProperties properties = new StorageServiceProperties() + BlobServiceProperties properties = new BlobServiceProperties() .setLogging(new Logging() .setWrite(true) .setDelete(true) @@ -182,7 +183,7 @@ public void setPropertiesWithResponse() { System.out.printf("Setting properties completed with status %d%n", client.setPropertiesWithResponse(properties, timeout, context).getStatusCode()); - // END: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#StorageServiceProperties-Duration-Context + // END: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#BlobServiceProperties-Duration-Context } /** diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy index b3e68437b3bc..898a72a38b97 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy @@ -25,11 +25,11 @@ import com.azure.core.util.Configuration import com.azure.core.util.logging.ClientLogger import com.azure.identity.credential.EnvironmentCredentialBuilder import com.azure.storage.blob.models.BlobContainerItem +import com.azure.storage.blob.models.BlobServiceProperties import com.azure.storage.blob.models.CopyStatusType import com.azure.storage.blob.models.LeaseStateType import com.azure.storage.blob.models.ListBlobContainersOptions import com.azure.storage.blob.models.RetentionPolicy -import com.azure.storage.blob.models.StorageServiceProperties import com.azure.storage.blob.specialized.BlobAsyncClientBase import com.azure.storage.blob.specialized.BlobClientBase import com.azure.storage.blob.specialized.LeaseClient @@ -657,14 +657,14 @@ class APISpec extends Specification { } def enableSoftDelete() { - primaryBlobServiceClient.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(true).setDays(2))) sleepIfRecord(30000) } def disableSoftDelete() { - primaryBlobServiceClient.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(false))) sleepIfRecord(30000) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy index bf77476d5d4d..815c663c2014 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders import com.azure.core.http.rest.Response import com.azure.storage.blob.models.BlobContainerItem import com.azure.storage.blob.models.BlobContainerListDetails +import com.azure.storage.blob.models.BlobServiceProperties import com.azure.storage.blob.models.CorsRule import com.azure.storage.blob.models.ListBlobContainersOptions import com.azure.storage.blob.models.Logging @@ -16,7 +17,6 @@ import com.azure.storage.blob.models.RetentionPolicy import com.azure.storage.blob.models.StaticWebsite import com.azure.storage.blob.models.StorageAccountInfo import com.azure.storage.blob.models.StorageException -import com.azure.storage.blob.models.StorageServiceProperties import com.azure.storage.blob.models.StorageServiceStats import com.azure.storage.blob.models.UserDelegationKey import com.azure.storage.common.credentials.SharedKeyCredential @@ -29,7 +29,7 @@ import java.time.OffsetDateTime class ServiceAPITest extends APISpec { def setup() { RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) - primaryBlobServiceClient.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setStaticWebsite(new StaticWebsite().setEnabled(false)) .setDeleteRetentionPolicy(disabled) .setCors(null) @@ -44,7 +44,7 @@ class ServiceAPITest extends APISpec { def cleanup() { RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) - primaryBlobServiceClient.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setStaticWebsite(new StaticWebsite().setEnabled(false)) .setDeleteRetentionPolicy(disabled) .setCors(null) @@ -160,7 +160,7 @@ class ServiceAPITest extends APISpec { containers.each { container -> container.delete() } } - def validatePropsSet(StorageServiceProperties sent, StorageServiceProperties received) { + def validatePropsSet(BlobServiceProperties sent, BlobServiceProperties received) { return received.getLogging().isRead() == sent.getLogging().isRead() && received.getLogging().isDelete() == sent.getLogging().isDelete() && received.getLogging().isWrite() == sent.getLogging().isWrite() && @@ -217,7 +217,7 @@ class ServiceAPITest extends APISpec { .setIndexDocument("myIndex.html") .setErrorDocument404Path("custom/error/path.html") - StorageServiceProperties sentProperties = new StorageServiceProperties() + BlobServiceProperties sentProperties = new BlobServiceProperties() .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) .setDeleteRetentionPolicy(retentionPolicy) @@ -228,7 +228,7 @@ class ServiceAPITest extends APISpec { // Service properties may take up to 30s to take effect. If they weren't already in place, wait. sleepIfRecord(30 * 1000) - StorageServiceProperties receivedProperties = primaryBlobServiceClient.getProperties() + BlobServiceProperties receivedProperties = primaryBlobServiceClient.getProperties() then: headers.getValue("x-ms-request-id") != null @@ -258,7 +258,7 @@ class ServiceAPITest extends APISpec { .setIndexDocument("myIndex.html") .setErrorDocument404Path("custom/error/path.html") - StorageServiceProperties sentProperties = new StorageServiceProperties() + BlobServiceProperties sentProperties = new BlobServiceProperties() .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) .setDeleteRetentionPolicy(retentionPolicy) @@ -271,7 +271,7 @@ class ServiceAPITest extends APISpec { def "Set props error"() { when: getServiceClient(primaryCredential, "https://error.blob.core.windows.net") - .setProperties(new StorageServiceProperties()) + .setProperties(new BlobServiceProperties()) then: thrown(StorageException) diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 74946d46356e..f4b3c334abc7 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -34,7 +34,7 @@ sync-methods: none license-header: MICROSOFT_MIT_SMALL add-context-parameter: true models-subpackage: implementation.models -custom-types: AccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHTTPHeaders,BlobItem,BlobProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,ContainerItem,ContainerProperties,CopyStatusType,CorsRule,CpkInfo,CustomerProvidedKeyInfo,DataLakeStorageError,DataLakeStorageErrorError,DataLakeStorageErrorException,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobsIncludeItem,ListContainersIncludeType,Logging,Metrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,RetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,SignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,StorageError,StorageErrorCode,StorageErrorException,StorageServiceProperties,StorageServiceStats,SyncCopyStatusType,UserDelegationKey +custom-types: AccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHTTPHeaders,BlobContainerItem,BlobItem,BlobContainerProperties,BlobProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,CorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,Logging,Metrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,RetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,SignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,StorageError,StorageErrorCode,StorageErrorException,StorageServiceStats,SyncCopyStatusType,UserDelegationKey custom-types-subpackage: models ``` @@ -726,19 +726,6 @@ directive: } ``` -### ListContainersSegmentResponse -``` yaml -directive: -- from: swagger-document - where: $.definitions.ListContainersSegmentResponse - transform: > - if (!$.required.includes("Prefix")) { - $.required.push("Prefix"); - $.required.push("MaxResults"); - $.required.push("NextMarker"); - } -``` - ### SignedIdentifier ``` yaml directive: @@ -935,3 +922,84 @@ directive: $["202"] = response; } ``` + +### Rename ListContainersIncludeType to ListBlobContainersIncludeType +``` yaml +directive: +- from: swagger-document + where: $.parameters.ListContainersInclude + transform: > + $["x-ms-enum"].name = "ListBlobContainersIncludeType"; +``` + +### /?restype=service&comp=properties +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.BlobServiceProperties) { + $.BlobServiceProperties = $.StorageServiceProperties; + delete $.StorageServiceProperties; + $.BlobServiceProperties.xml = { "name": "StorageServiceProperties" }; + } + if (!$.BlobContainerProperties) { + $.BlobContainerProperties = $.ContainerProperties; + delete $.ContainerProperties; + } + if (!$.BlobContainerItem) { + $.BlobContainerItem = $.ContainerItem; + const path = $.BlobContainerItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobContainerProperties"); + $.BlobContainerItem.properties.Properties.$ref = path; + delete $.ContainerItem; + } +- from: swagger-document + where: $.parameters + transform: > + if (!$.BlobServiceProperties) { + const props = $.BlobServiceProperties = $.StorageServiceProperties; + props.name = "BlobServiceProperties"; + props.schema = { "$ref": props.schema.$ref.replace(/[#].*$/, "#/definitions/BlobServiceProperties") }; + delete $.StorageServiceProperties; + } +- from: swagger-document + where: $["x-ms-paths"]["/?restype=service&comp=properties"] + transform: > + const param = $.put.parameters[0]; + if (param && param["$ref"] && param["$ref"].endsWith("StorageServiceProperties")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/BlobServiceProperties"); + $.put.parameters[0] = { "$ref": path }; + } + const def = $.get.responses["200"].schema; + if (def && def["$ref"] && def["$ref"].endsWith("StorageServiceProperties")) { + const path = def["$ref"].replace(/[#].*$/, "#/definitions/BlobServiceProperties"); + $.get.responses["200"].schema = { "$ref": path }; + } +``` + +### /?comp=list +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.BlobContainersSegment) { + $.BlobContainersSegment = $.ListContainersSegmentResponse; + delete $.ListContainersSegmentResponse; + $.BlobContainersSegment["x-az-public"] = false; + $.BlobContainersSegment.required.push("NextMarker"); + $.BlobContainersSegment.properties.BlobContainerItems = $.BlobContainersSegment.properties.ContainerItems; + delete $.BlobContainersSegment.properties.ContainerItems; + const path = $.BlobContainersSegment.properties.BlobContainerItems.items.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItem"); + $.BlobContainersSegment.properties.BlobContainerItems.items.$ref = path; + } +- from: swagger-document + where: $["x-ms-paths"]["/?comp=list"] + transform: > + const def = $.get.responses["200"].schema; + if (def && def["$ref"] && !def["$ref"].endsWith("BlobContainersSegment")) { + const path = def["$ref"].replace(/[#].*$/, "#/definitions/BlobContainersSegment"); + $.get.responses["200"].schema = { "$ref": path }; + } + $.get.operationId = "Service_ListBlobContainersSegment"; +``` From 330a38095bb979b165583220180c16761c2faa8b Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 07/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From 2c92acff69a38cfbfa99ad1e2147e45fa3b842f4 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 08/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../storage/blob/BlobServiceAsyncClient.java | 35 +++---- .../azure/storage/blob/BlobServiceClient.java | 19 ++-- .../blob/implementation/BlobsImpl.java | 2 +- .../blob/implementation/DirectorysImpl.java | 2 +- .../blob/implementation/ServicesImpl.java | 28 +++--- ...sponse.java => BlobContainersSegment.java} | 86 ++++++++--------- .../models/ListBlobsFlatSegmentResponse.java | 26 ----- ...viceListBlobContainersSegmentHeaders.java} | 22 ++--- .../models/ServicesGetPropertiesResponse.java | 8 +- ...cesListBlobContainersSegmentResponse.java} | 12 +-- .../blob/models/BlobContainerItem.java | 6 +- .../blob/models/BlobContainerProperties.java | 18 ++-- ...erties.java => BlobServiceProperties.java} | 30 +++--- .../models/ListBlobContainersIncludeType.java | 8 +- ...ServiceAsyncClientJavaDocCodeSnippets.java | 19 ++-- .../BlobServiceClientJavaDocCodeSnippets.java | 23 ++--- .../com/azure/storage/blob/APISpec.groovy | 6 +- .../azure/storage/blob/ServiceAPITest.groovy | 16 ++-- .../azure-storage-blob/swagger/README.md | 96 ++++++++++++++++--- 19 files changed, 254 insertions(+), 208 deletions(-) rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/{ListContainersSegmentResponse.java => BlobContainersSegment.java} (67%) rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/{ServiceListContainersSegmentHeaders.java => ServiceListBlobContainersSegmentHeaders.java} (80%) rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/{ServicesListContainersSegmentResponse.java => ServicesListBlobContainersSegmentResponse.java} (60%) rename sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/{StorageServiceProperties.java => BlobServiceProperties.java} (84%) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index 6746e5d14043..e112a9c30666 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -3,9 +3,6 @@ package com.azure.storage.blob; -import static com.azure.core.implementation.util.FluxUtil.withContext; -import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse; - import com.azure.core.annotation.ServiceClient; import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpPipeline; @@ -19,22 +16,26 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.implementation.models.ServicesListContainersSegmentResponse; +import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse; import com.azure.storage.blob.models.BlobContainerItem; +import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; -import com.azure.storage.blob.models.StorageServiceProperties; import com.azure.storage.blob.models.StorageServiceStats; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Utility; +import reactor.core.publisher.Mono; + import java.time.Duration; import java.time.OffsetDateTime; import java.util.Map; import java.util.function.Function; -import reactor.core.publisher.Mono; + +import static com.azure.core.implementation.util.FluxUtil.withContext; +import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse; /** * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does @@ -234,19 +235,19 @@ PagedFlux listBlobContainersWithOptionalTimeout(ListBlobConta response.getRequest(), response.getStatusCode(), response.getHeaders(), - response.getValue().getContainerItems(), + response.getValue().getBlobContainerItems(), response.getValue().getNextMarker(), response.getDeserializedHeaders())); return new PagedFlux<>(() -> func.apply(null), func); } - private Mono listBlobContainersSegment(String marker, + private Mono listBlobContainersSegment(String marker, ListBlobContainersOptions options, Duration timeout) { options = options == null ? new ListBlobContainersOptions() : options; return postProcessResponse(Utility.applyOptionalTimeout( - this.azureBlobStorage.services().listContainersSegmentWithRestResponseAsync( + this.azureBlobStorage.services().listBlobContainersSegmentWithRestResponseAsync( options.getPrefix(), marker, options.getMaxResults(), options.getDetails().toIncludeType(), null, null, Context.NONE), timeout)); } @@ -261,7 +262,7 @@ private Mono listBlobContainersSegment(St * * @return A reactive response containing the storage account properties. */ - public Mono getProperties() { + public Mono getProperties() { return getPropertiesWithResponse().flatMap(FluxUtil::toMono); } @@ -276,11 +277,11 @@ public Mono getProperties() { * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the storage * account properties. */ - public Mono> getPropertiesWithResponse() { + public Mono> getPropertiesWithResponse() { return withContext(this::getPropertiesWithResponse); } - Mono> getPropertiesWithResponse(Context context) { + Mono> getPropertiesWithResponse(Context context) { return postProcessResponse( this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, rb.getValue())); @@ -294,12 +295,12 @@ Mono> getPropertiesWithResponse(Context conte * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setProperties#StorageServiceProperties} + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setProperties#BlobServiceProperties} * * @param properties Configures the service. * @return A {@link Mono} containing the storage account properties. */ - public Mono setProperties(StorageServiceProperties properties) { + public Mono setProperties(BlobServiceProperties properties) { return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); } @@ -310,16 +311,16 @@ public Mono setProperties(StorageServiceProperties properties) { * sets the version header on each request, overriding the default. *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#StorageServiceProperties} + * {@codesnippet com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#BlobServiceProperties} * * @param properties Configures the service. * @return A {@link Mono} containing the storage account properties. */ - public Mono> setPropertiesWithResponse(StorageServiceProperties properties) { + public Mono> setPropertiesWithResponse(BlobServiceProperties properties) { return withContext(context -> setPropertiesWithResponse(properties, context)); } - Mono> setPropertiesWithResponse(StorageServiceProperties properties, Context context) { + Mono> setPropertiesWithResponse(BlobServiceProperties properties, Context context) { return postProcessResponse( this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context)) .map(response -> new SimpleResponse<>(response, null)); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index 761f2691a8cc..e1521dc1b0a7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -11,17 +11,18 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobContainerItem; +import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; -import com.azure.storage.blob.models.StorageServiceProperties; import com.azure.storage.blob.models.StorageServiceStats; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Utility; +import reactor.core.publisher.Mono; + import java.time.Duration; import java.time.OffsetDateTime; import java.util.Map; -import reactor.core.publisher.Mono; /** * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does @@ -191,7 +192,7 @@ public PagedIterable listBlobContainers(ListBlobContainersOpt * * @return The storage account properties. */ - public StorageServiceProperties getProperties() { + public BlobServiceProperties getProperties() { return getPropertiesWithResponse(null, Context.NONE).getValue(); } @@ -207,9 +208,9 @@ public StorageServiceProperties getProperties() { * @param context Additional context that is passed through the Http pipeline during the service call. * @return A {@link Response} whose {@link Response#getValue() value} contains the storage account properties. */ - public Response getPropertiesWithResponse(Duration timeout, Context context) { + public Response getPropertiesWithResponse(Duration timeout, Context context) { - Mono> response = blobServiceAsyncClient.getPropertiesWithResponse(context); + Mono> response = blobServiceAsyncClient.getPropertiesWithResponse(context); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -222,11 +223,11 @@ public Response getPropertiesWithResponse(Duration tim * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobServiceClient.setProperties#StorageServiceProperties} + * {@codesnippet com.azure.storage.blob.BlobServiceClient.setProperties#BlobServiceProperties} * * @param properties Configures the service. */ - public void setProperties(StorageServiceProperties properties) { + public void setProperties(BlobServiceProperties properties) { setPropertiesWithResponse(properties, null, Context.NONE); } @@ -238,14 +239,14 @@ public void setProperties(StorageServiceProperties properties) { * *

Code Samples

* - * {@codesnippet com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#StorageServiceProperties-Duration-Context} + * {@codesnippet com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#BlobServiceProperties-Duration-Context} * * @param properties Configures the service. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @param context Additional context that is passed through the Http pipeline during the service call. * @return The storage account properties. */ - public Response setPropertiesWithResponse(StorageServiceProperties properties, Duration timeout, + public Response setPropertiesWithResponse(BlobServiceProperties properties, Duration timeout, Context context) { Mono> response = blobServiceAsyncClient.setPropertiesWithResponse(properties, context); diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java index 5626195f0321..391fd548e2b9 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java @@ -43,11 +43,11 @@ import com.azure.storage.blob.implementation.models.BlobsSetTierResponse; import com.azure.storage.blob.implementation.models.BlobsStartCopyFromURLResponse; import com.azure.storage.blob.implementation.models.BlobsUndeleteResponse; +import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException; import com.azure.storage.blob.implementation.models.DirectoryHttpHeaders; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.CpkInfo; -import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException; import com.azure.storage.blob.models.DeleteSnapshotsOptionType; import com.azure.storage.blob.models.EncryptionAlgorithmType; import com.azure.storage.blob.models.LeaseAccessConditions; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java index e26340bd8079..f50c46ed2342 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/DirectorysImpl.java @@ -21,13 +21,13 @@ import com.azure.core.implementation.DateTimeRfc1123; import com.azure.core.implementation.RestProxy; import com.azure.core.util.Context; +import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException; import com.azure.storage.blob.implementation.models.DirectoryHttpHeaders; import com.azure.storage.blob.implementation.models.DirectorysCreateResponse; import com.azure.storage.blob.implementation.models.DirectorysDeleteResponse; import com.azure.storage.blob.implementation.models.DirectorysGetAccessControlResponse; import com.azure.storage.blob.implementation.models.DirectorysRenameResponse; import com.azure.storage.blob.implementation.models.DirectorysSetAccessControlResponse; -import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException; import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ModifiedAccessConditions; import com.azure.storage.blob.models.PathRenameMode; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index ce6e74808c29..c2b7614087fd 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -23,13 +23,13 @@ import com.azure.storage.blob.implementation.models.ServicesGetPropertiesResponse; import com.azure.storage.blob.implementation.models.ServicesGetStatisticsResponse; import com.azure.storage.blob.implementation.models.ServicesGetUserDelegationKeyResponse; -import com.azure.storage.blob.implementation.models.ServicesListContainersSegmentResponse; +import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse; import com.azure.storage.blob.implementation.models.ServicesSetPropertiesResponse; import com.azure.storage.blob.implementation.models.ServicesSubmitBatchResponse; +import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersIncludeType; import com.azure.storage.blob.models.StorageErrorException; -import com.azure.storage.blob.models.StorageServiceProperties; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -70,7 +70,7 @@ private interface ServicesService { @Put("") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") StorageServiceProperties storageServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") BlobServiceProperties blobServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @Get("") @ExpectedResponses({200}) @@ -85,7 +85,7 @@ private interface ServicesService { @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListBlobContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); + Mono listBlobContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListBlobContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); @Post("") @ExpectedResponses({200}) @@ -106,24 +106,24 @@ private interface ServicesService { /** * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. * - * @param storageServiceProperties The StorageService properties. + * @param blobServiceProperties The StorageService properties. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Context context) { + public Mono setPropertiesWithRestResponseAsync(BlobServiceProperties blobServiceProperties, Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); + return service.setProperties(this.client.getUrl(), blobServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** * Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. * - * @param storageServiceProperties The StorageService properties. + * @param blobServiceProperties The StorageService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. * @param context The context to associate with this operation. @@ -131,10 +131,10 @@ public Mono setPropertiesWithRestResponseAsync(St * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Integer timeout, String requestId, Context context) { + public Mono setPropertiesWithRestResponseAsync(BlobServiceProperties blobServiceProperties, Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); + return service.setProperties(this.client.getUrl(), blobServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -209,7 +209,7 @@ public Mono getStatisticsWithRestResponseAsync(In * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono listContainersSegmentWithRestResponseAsync(Context context) { + public Mono listBlobContainersSegmentWithRestResponseAsync(Context context) { final String prefix = null; final String marker = null; final Integer maxresults = null; @@ -217,7 +217,7 @@ public Mono listContainersSegmentWithRest final Integer timeout = null; final String requestId = null; final String comp = "list"; - return service.listContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); + return service.listBlobContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); } /** @@ -234,9 +234,9 @@ public Mono listContainersSegmentWithRest * @return a Mono which performs the network request upon subscription. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono listContainersSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, ListBlobContainersIncludeType include, Integer timeout, String requestId, Context context) { + public Mono listBlobContainersSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, ListBlobContainersIncludeType include, Integer timeout, String requestId, Context context) { final String comp = "list"; - return service.listContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); + return service.listBlobContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); } /** diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListContainersSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobContainersSegment.java similarity index 67% rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListContainersSegmentResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobContainersSegment.java index 21c76df8dde3..6c3e9d25558b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListContainersSegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/BlobContainersSegment.java @@ -18,7 +18,7 @@ */ @JacksonXmlRootElement(localName = "EnumerationResults") @Fluent -public final class ListContainersSegmentResponse { +public final class BlobContainersSegment { /* * The serviceEndpoint property. */ @@ -28,7 +28,7 @@ public final class ListContainersSegmentResponse { /* * The prefix property. */ - @JsonProperty(value = "Prefix", required = true) + @JsonProperty(value = "Prefix") private String prefix; /* @@ -40,8 +40,14 @@ public final class ListContainersSegmentResponse { /* * The maxResults property. */ - @JsonProperty(value = "MaxResults", required = true) - private int maxResults; + @JsonProperty(value = "MaxResults") + private Integer maxResults; + + /* + * The nextMarker property. + */ + @JsonProperty(value = "NextMarker", required = true) + private String nextMarker; private static final class ContainersWrapper { @JacksonXmlProperty(localName = "Container") @@ -54,16 +60,10 @@ private ContainersWrapper(@JacksonXmlProperty(localName = "Container") List getContainerItems() { - if (this.containerItems == null) { - this.containerItems = new ContainersWrapper(new ArrayList()); - } - return this.containerItems.items; + public String getNextMarker() { + return this.nextMarker; } /** - * Set the containerItems property: The containerItems property. + * Set the nextMarker property: The nextMarker property. * - * @param blobContainerItems the containerItems value to set. - * @return the ListContainersSegmentResponse object itself. + * @param nextMarker the nextMarker value to set. + * @return the BlobContainersSegment object itself. */ - public ListContainersSegmentResponse setContainerItems(List blobContainerItems) { - this.containerItems = new ContainersWrapper(blobContainerItems); + public BlobContainersSegment setNextMarker(String nextMarker) { + this.nextMarker = nextMarker; return this; } /** - * Get the nextMarker property: The nextMarker property. + * Get the blobContainerItems property: The blobContainerItems property. * - * @return the nextMarker value. + * @return the blobContainerItems value. */ - public String getNextMarker() { - return this.nextMarker; + public List getBlobContainerItems() { + if (this.blobContainerItems == null) { + this.blobContainerItems = new ContainersWrapper(new ArrayList()); + } + return this.blobContainerItems.items; } /** - * Set the nextMarker property: The nextMarker property. + * Set the blobContainerItems property: The blobContainerItems property. * - * @param nextMarker the nextMarker value to set. - * @return the ListContainersSegmentResponse object itself. + * @param blobContainerItems the blobContainerItems value to set. + * @return the BlobContainersSegment object itself. */ - public ListContainersSegmentResponse setNextMarker(String nextMarker) { - this.nextMarker = nextMarker; + public BlobContainersSegment setBlobContainerItems(List blobContainerItems) { + this.blobContainerItems = new ContainersWrapper(blobContainerItems); return this; } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListBlobsFlatSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListBlobsFlatSegmentResponse.java index 3991764e4670..09a93450c0e4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListBlobsFlatSegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ListBlobsFlatSegmentResponse.java @@ -45,12 +45,6 @@ public final class ListBlobsFlatSegmentResponse { @JsonProperty(value = "MaxResults", required = true) private int maxResults; - /* - * The delimiter property. - */ - @JsonProperty(value = "Delimiter", required = true) - private String delimiter; - /* * The segment property. */ @@ -163,26 +157,6 @@ public ListBlobsFlatSegmentResponse setMaxResults(int maxResults) { return this; } - /** - * Get the delimiter property: The delimiter property. - * - * @return the delimiter value. - */ - public String getDelimiter() { - return this.delimiter; - } - - /** - * Set the delimiter property: The delimiter property. - * - * @param delimiter the delimiter value to set. - * @return the ListBlobsFlatSegmentResponse object itself. - */ - public ListBlobsFlatSegmentResponse setDelimiter(String delimiter) { - this.delimiter = delimiter; - return this; - } - /** * Get the segment property: The segment property. * diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListContainersSegmentHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListBlobContainersSegmentHeaders.java similarity index 80% rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListContainersSegmentHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListBlobContainersSegmentHeaders.java index 9f73b4639d2e..6d402b18510f 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListContainersSegmentHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServiceListBlobContainersSegmentHeaders.java @@ -9,11 +9,11 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; /** - * Defines headers for ListContainersSegment operation. + * Defines headers for ListBlobContainersSegment operation. */ -@JacksonXmlRootElement(localName = "Service-ListContainersSegment-Headers") +@JacksonXmlRootElement(localName = "Service-ListBlobContainersSegment-Headers") @Fluent -public final class ServiceListContainersSegmentHeaders { +public final class ServiceListBlobContainersSegmentHeaders { /* * If a client request id header is sent in the request, this header will * be present in the response with the same value. @@ -59,9 +59,9 @@ public String getClientRequestId() { * same value. * * @param clientRequestId the clientRequestId value to set. - * @return the ServiceListContainersSegmentHeaders object itself. + * @return the ServiceListBlobContainersSegmentHeaders object itself. */ - public ServiceListContainersSegmentHeaders setClientRequestId(String clientRequestId) { + public ServiceListBlobContainersSegmentHeaders setClientRequestId(String clientRequestId) { this.clientRequestId = clientRequestId; return this; } @@ -81,9 +81,9 @@ public String getRequestId() { * that was made and can be used for troubleshooting the request. * * @param requestId the requestId value to set. - * @return the ServiceListContainersSegmentHeaders object itself. + * @return the ServiceListBlobContainersSegmentHeaders object itself. */ - public ServiceListContainersSegmentHeaders setRequestId(String requestId) { + public ServiceListBlobContainersSegmentHeaders setRequestId(String requestId) { this.requestId = requestId; return this; } @@ -105,9 +105,9 @@ public String getVersion() { * against version 2009-09-19 and above. * * @param version the version value to set. - * @return the ServiceListContainersSegmentHeaders object itself. + * @return the ServiceListBlobContainersSegmentHeaders object itself. */ - public ServiceListContainersSegmentHeaders setVersion(String version) { + public ServiceListBlobContainersSegmentHeaders setVersion(String version) { this.version = version; return this; } @@ -125,9 +125,9 @@ public String getErrorCode() { * Set the errorCode property: The errorCode property. * * @param errorCode the errorCode value to set. - * @return the ServiceListContainersSegmentHeaders object itself. + * @return the ServiceListBlobContainersSegmentHeaders object itself. */ - public ServiceListContainersSegmentHeaders setErrorCode(String errorCode) { + public ServiceListBlobContainersSegmentHeaders setErrorCode(String errorCode) { this.errorCode = errorCode; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServicesGetPropertiesResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServicesGetPropertiesResponse.java index 8259f6c7629b..33d406d5ae58 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServicesGetPropertiesResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/models/ServicesGetPropertiesResponse.java @@ -7,12 +7,12 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpRequest; import com.azure.core.http.rest.ResponseBase; -import com.azure.storage.blob.models.StorageServiceProperties; +import com.azure.storage.blob.models.BlobServiceProperties; /** * Contains all response data for the getProperties operation. */ -public final class ServicesGetPropertiesResponse extends ResponseBase { +public final class ServicesGetPropertiesResponse extends ResponseBase { /** * Creates an instance of ServicesGetPropertiesResponse. * @@ -22,7 +22,7 @@ public final class ServicesGetPropertiesResponse extends ResponseBase { +public final class ServicesListBlobContainersSegmentResponse extends ResponseBase { /** - * Creates an instance of ServicesListContainersSegmentResponse. + * Creates an instance of ServicesListBlobContainersSegmentResponse. * - * @param request the request which resulted in this ServicesListContainersSegmentResponse. + * @param request the request which resulted in this ServicesListBlobContainersSegmentResponse. * @param statusCode the status code of the HTTP response. * @param rawHeaders the raw headers of the HTTP response. * @param value the deserialized value of the HTTP response. * @param headers the deserialized headers of the HTTP response. */ - public ServicesListContainersSegmentResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ListContainersSegmentResponse value, ServiceListContainersSegmentHeaders headers) { + public ServicesListBlobContainersSegmentResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, BlobContainersSegment value, ServiceListBlobContainersSegmentHeaders headers) { super(request, statusCode, rawHeaders, value, headers); } @@ -29,7 +29,7 @@ public ServicesListContainersSegmentResponse(HttpRequest request, int statusCode * @return the deserialized response body. */ @Override - public ListContainersSegmentResponse getValue() { + public BlobContainersSegment getValue() { return super.getValue(); } } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItem.java index 075fe680dec7..28e75f1e2aa0 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItem.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItem.java @@ -46,7 +46,7 @@ public String getName() { * Set the name property: The name property. * * @param name the name value to set. - * @return the ContainerItem object itself. + * @return the BlobContainerItem object itself. */ public BlobContainerItem setName(String name) { this.name = name; @@ -66,7 +66,7 @@ public BlobContainerProperties getProperties() { * Set the properties property: The properties property. * * @param properties the properties value to set. - * @return the ContainerItem object itself. + * @return the BlobContainerItem object itself. */ public BlobContainerItem setProperties(BlobContainerProperties properties) { this.properties = properties; @@ -86,7 +86,7 @@ public Map getMetadata() { * Set the metadata property: The metadata property. * * @param metadata the metadata value to set. - * @return the ContainerItem object itself. + * @return the BlobContainerItem object itself. */ public BlobContainerItem setMetadata(Map metadata) { this.metadata = metadata; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerProperties.java index 9ce79fb00916..64160c276cc2 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerProperties.java @@ -13,7 +13,7 @@ /** * Properties of a container. */ -@JacksonXmlRootElement(localName = "ContainerProperties") +@JacksonXmlRootElement(localName = "BlobContainerProperties") @Fluent public final class BlobContainerProperties { /* @@ -81,7 +81,7 @@ public OffsetDateTime getLastModified() { * Set the lastModified property: The lastModified property. * * @param lastModified the lastModified value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { @@ -105,7 +105,7 @@ public String getEtag() { * Set the etag property: The etag property. * * @param etag the etag value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setEtag(String etag) { this.etag = etag; @@ -127,7 +127,7 @@ public LeaseStatusType getLeaseStatus() { * 'unlocked'. * * @param leaseStatus the leaseStatus value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; @@ -149,7 +149,7 @@ public LeaseStateType getLeaseState() { * 'leased', 'expired', 'breaking', 'broken'. * * @param leaseState the leaseState value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; @@ -171,7 +171,7 @@ public LeaseDurationType getLeaseDuration() { * 'fixed'. * * @param leaseDuration the leaseDuration value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; @@ -193,7 +193,7 @@ public PublicAccessType getPublicAccess() { * 'blob'. * * @param publicAccess the publicAccess value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setPublicAccess(PublicAccessType publicAccess) { this.publicAccess = publicAccess; @@ -215,7 +215,7 @@ public Boolean isHasImmutabilityPolicy() { * property. * * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setHasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { this.hasImmutabilityPolicy = hasImmutabilityPolicy; @@ -235,7 +235,7 @@ public Boolean isHasLegalHold() { * Set the hasLegalHold property: The hasLegalHold property. * * @param hasLegalHold the hasLegalHold value to set. - * @return the ContainerProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerProperties setHasLegalHold(Boolean hasLegalHold) { this.hasLegalHold = hasLegalHold; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java similarity index 84% rename from sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java index 6cf9ea619c36..254b6ea685be 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java @@ -17,7 +17,7 @@ */ @JacksonXmlRootElement(localName = "StorageServiceProperties") @Fluent -public final class StorageServiceProperties { +public final class BlobServiceProperties { /* * The logging property. */ @@ -85,9 +85,9 @@ public Logging getLogging() { * Set the logging property: The logging property. * * @param logging the logging value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setLogging(Logging logging) { + public BlobServiceProperties setLogging(Logging logging) { this.logging = logging; return this; } @@ -105,9 +105,9 @@ public Metrics getHourMetrics() { * Set the hourMetrics property: The hourMetrics property. * * @param hourMetrics the hourMetrics value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setHourMetrics(Metrics hourMetrics) { + public BlobServiceProperties setHourMetrics(Metrics hourMetrics) { this.hourMetrics = hourMetrics; return this; } @@ -125,9 +125,9 @@ public Metrics getMinuteMetrics() { * Set the minuteMetrics property: The minuteMetrics property. * * @param minuteMetrics the minuteMetrics value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setMinuteMetrics(Metrics minuteMetrics) { + public BlobServiceProperties setMinuteMetrics(Metrics minuteMetrics) { this.minuteMetrics = minuteMetrics; return this; } @@ -148,9 +148,9 @@ public List getCors() { * Set the cors property: The set of CORS rules. * * @param cors the cors value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setCors(List cors) { + public BlobServiceProperties setCors(List cors) { this.cors = new CorsWrapper(cors); return this; } @@ -174,9 +174,9 @@ public String getDefaultServiceVersion() { * recent versions. * * @param defaultServiceVersion the defaultServiceVersion value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setDefaultServiceVersion(String defaultServiceVersion) { + public BlobServiceProperties setDefaultServiceVersion(String defaultServiceVersion) { this.defaultServiceVersion = defaultServiceVersion; return this; } @@ -196,9 +196,9 @@ public RetentionPolicy getDeleteRetentionPolicy() { * property. * * @param deleteRetentionPolicy the deleteRetentionPolicy value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setDeleteRetentionPolicy(RetentionPolicy deleteRetentionPolicy) { + public BlobServiceProperties setDeleteRetentionPolicy(RetentionPolicy deleteRetentionPolicy) { this.deleteRetentionPolicy = deleteRetentionPolicy; return this; } @@ -216,9 +216,9 @@ public StaticWebsite getStaticWebsite() { * Set the staticWebsite property: The staticWebsite property. * * @param staticWebsite the staticWebsite value to set. - * @return the StorageServiceProperties object itself. + * @return the BlobServiceProperties object itself. */ - public StorageServiceProperties setStaticWebsite(StaticWebsite staticWebsite) { + public BlobServiceProperties setStaticWebsite(StaticWebsite staticWebsite) { this.staticWebsite = staticWebsite; return this; } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobContainersIncludeType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobContainersIncludeType.java index dc7200e8b79b..03601bdcd962 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobContainersIncludeType.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobContainersIncludeType.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue; /** - * Defines values for ListContainersIncludeType. + * Defines values for ListBlobContainersIncludeType. */ public enum ListBlobContainersIncludeType { /** @@ -17,7 +17,7 @@ public enum ListBlobContainersIncludeType { METADATA("metadata"); /** - * The actual serialized value for a ListContainersIncludeType instance. + * The actual serialized value for a ListBlobContainersIncludeType instance. */ private final String value; @@ -26,10 +26,10 @@ public enum ListBlobContainersIncludeType { } /** - * Parses a serialized value to a ListContainersIncludeType instance. + * Parses a serialized value to a ListBlobContainersIncludeType instance. * * @param value the serialized value to parse. - * @return the parsed ListContainersIncludeType object, or null if unable to parse. + * @return the parsed ListBlobContainersIncludeType object, or null if unable to parse. */ @JsonCreator public static ListBlobContainersIncludeType fromString(String value) { diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java index b5b7a22ead5b..417b87e53abd 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java @@ -5,12 +5,13 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobContainerListDetails; +import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.Logging; import com.azure.storage.blob.models.Metrics; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.RetentionPolicy; -import com.azure.storage.blob.models.StorageServiceProperties; + import java.time.OffsetDateTime; import java.util.Collections; import java.util.Map; @@ -119,14 +120,14 @@ public void getPropertiesWithResponse() { } /** - * Code snippet for {@link BlobServiceAsyncClient#setProperties(StorageServiceProperties)} + * Code snippet for {@link BlobServiceAsyncClient#setProperties(BlobServiceProperties)} */ public void setProperties() { - // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#StorageServiceProperties + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#BlobServiceProperties RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); - StorageServiceProperties properties = new StorageServiceProperties() + BlobServiceProperties properties = new BlobServiceProperties() .setLogging(new Logging() .setWrite(true) .setDelete(true) @@ -141,18 +142,18 @@ public void setProperties() { client.setProperties(properties).subscribe( response -> System.out.printf("Setting properties completed%n"), error -> System.out.printf("Setting properties failed: %s%n", error)); - // END: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#StorageServiceProperties + // END: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#BlobServiceProperties } /** - * Code snippet for {@link BlobServiceAsyncClient#setPropertiesWithResponse(StorageServiceProperties)} + * Code snippet for {@link BlobServiceAsyncClient#setPropertiesWithResponse(BlobServiceProperties)} */ public void setPropertiesWithResponse() { - // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#StorageServiceProperties + // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#BlobServiceProperties RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); - StorageServiceProperties properties = new StorageServiceProperties() + BlobServiceProperties properties = new BlobServiceProperties() .setLogging(new Logging() .setWrite(true) .setDelete(true) @@ -166,7 +167,7 @@ public void setPropertiesWithResponse() { client.setPropertiesWithResponse(properties).subscribe(response -> System.out.printf("Setting properties completed with status %d%n", response.getStatusCode())); - // END: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#StorageServiceProperties + // END: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#BlobServiceProperties } /** diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java index 6c499f745c80..9c247a895441 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java @@ -5,13 +5,14 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobContainerListDetails; +import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.Logging; import com.azure.storage.blob.models.Metrics; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.RetentionPolicy; import com.azure.storage.blob.models.StorageAccountInfo; -import com.azure.storage.blob.models.StorageServiceProperties; + import java.time.Duration; import java.time.OffsetDateTime; import java.util.Collections; @@ -107,7 +108,7 @@ public void listContainers() { */ public void getProperties() { // BEGIN: com.azure.storage.blob.BlobServiceClient.getProperties - StorageServiceProperties properties = client.getProperties(); + BlobServiceProperties properties = client.getProperties(); System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b%n", properties.getHourMetrics().isEnabled(), @@ -121,7 +122,7 @@ public void getProperties() { public void getPropertiesWithResponse() { // BEGIN: com.azure.storage.blob.BlobServiceClient.getPropertiesWithResponse#Duration-Context Context context = new Context("Key", "Value"); - StorageServiceProperties properties = client.getPropertiesWithResponse(timeout, context).getValue(); + BlobServiceProperties properties = client.getPropertiesWithResponse(timeout, context).getValue(); System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b%n", properties.getHourMetrics().isEnabled(), @@ -130,14 +131,14 @@ public void getPropertiesWithResponse() { } /** - * Code snippet for {@link BlobServiceClient#setProperties(StorageServiceProperties)} + * Code snippet for {@link BlobServiceClient#setProperties(BlobServiceProperties)} */ public void setProperties() { - // BEGIN: com.azure.storage.blob.BlobServiceClient.setProperties#StorageServiceProperties + // BEGIN: com.azure.storage.blob.BlobServiceClient.setProperties#BlobServiceProperties RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); - StorageServiceProperties properties = new StorageServiceProperties() + BlobServiceProperties properties = new BlobServiceProperties() .setLogging(new Logging() .setWrite(true) .setDelete(true) @@ -155,18 +156,18 @@ public void setProperties() { } catch (UnsupportedOperationException error) { System.out.printf("Setting properties failed: %s%n", error); } - // END: com.azure.storage.blob.BlobServiceClient.setProperties#StorageServiceProperties + // END: com.azure.storage.blob.BlobServiceClient.setProperties#BlobServiceProperties } /** - * Code snippet for {@link BlobServiceClient#setPropertiesWithResponse(StorageServiceProperties, Duration, Context)} + * Code snippet for {@link BlobServiceClient#setPropertiesWithResponse(BlobServiceProperties, Duration, Context)} */ public void setPropertiesWithResponse() { - // BEGIN: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#StorageServiceProperties-Duration-Context + // BEGIN: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#BlobServiceProperties-Duration-Context RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); - StorageServiceProperties properties = new StorageServiceProperties() + BlobServiceProperties properties = new BlobServiceProperties() .setLogging(new Logging() .setWrite(true) .setDelete(true) @@ -182,7 +183,7 @@ public void setPropertiesWithResponse() { System.out.printf("Setting properties completed with status %d%n", client.setPropertiesWithResponse(properties, timeout, context).getStatusCode()); - // END: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#StorageServiceProperties-Duration-Context + // END: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#BlobServiceProperties-Duration-Context } /** diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy index b3e68437b3bc..898a72a38b97 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy @@ -25,11 +25,11 @@ import com.azure.core.util.Configuration import com.azure.core.util.logging.ClientLogger import com.azure.identity.credential.EnvironmentCredentialBuilder import com.azure.storage.blob.models.BlobContainerItem +import com.azure.storage.blob.models.BlobServiceProperties import com.azure.storage.blob.models.CopyStatusType import com.azure.storage.blob.models.LeaseStateType import com.azure.storage.blob.models.ListBlobContainersOptions import com.azure.storage.blob.models.RetentionPolicy -import com.azure.storage.blob.models.StorageServiceProperties import com.azure.storage.blob.specialized.BlobAsyncClientBase import com.azure.storage.blob.specialized.BlobClientBase import com.azure.storage.blob.specialized.LeaseClient @@ -657,14 +657,14 @@ class APISpec extends Specification { } def enableSoftDelete() { - primaryBlobServiceClient.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(true).setDays(2))) sleepIfRecord(30000) } def disableSoftDelete() { - primaryBlobServiceClient.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(false))) sleepIfRecord(30000) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy index bf77476d5d4d..815c663c2014 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy @@ -7,6 +7,7 @@ import com.azure.core.http.HttpHeaders import com.azure.core.http.rest.Response import com.azure.storage.blob.models.BlobContainerItem import com.azure.storage.blob.models.BlobContainerListDetails +import com.azure.storage.blob.models.BlobServiceProperties import com.azure.storage.blob.models.CorsRule import com.azure.storage.blob.models.ListBlobContainersOptions import com.azure.storage.blob.models.Logging @@ -16,7 +17,6 @@ import com.azure.storage.blob.models.RetentionPolicy import com.azure.storage.blob.models.StaticWebsite import com.azure.storage.blob.models.StorageAccountInfo import com.azure.storage.blob.models.StorageException -import com.azure.storage.blob.models.StorageServiceProperties import com.azure.storage.blob.models.StorageServiceStats import com.azure.storage.blob.models.UserDelegationKey import com.azure.storage.common.credentials.SharedKeyCredential @@ -29,7 +29,7 @@ import java.time.OffsetDateTime class ServiceAPITest extends APISpec { def setup() { RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) - primaryBlobServiceClient.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setStaticWebsite(new StaticWebsite().setEnabled(false)) .setDeleteRetentionPolicy(disabled) .setCors(null) @@ -44,7 +44,7 @@ class ServiceAPITest extends APISpec { def cleanup() { RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) - primaryBlobServiceClient.setProperties(new StorageServiceProperties() + primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setStaticWebsite(new StaticWebsite().setEnabled(false)) .setDeleteRetentionPolicy(disabled) .setCors(null) @@ -160,7 +160,7 @@ class ServiceAPITest extends APISpec { containers.each { container -> container.delete() } } - def validatePropsSet(StorageServiceProperties sent, StorageServiceProperties received) { + def validatePropsSet(BlobServiceProperties sent, BlobServiceProperties received) { return received.getLogging().isRead() == sent.getLogging().isRead() && received.getLogging().isDelete() == sent.getLogging().isDelete() && received.getLogging().isWrite() == sent.getLogging().isWrite() && @@ -217,7 +217,7 @@ class ServiceAPITest extends APISpec { .setIndexDocument("myIndex.html") .setErrorDocument404Path("custom/error/path.html") - StorageServiceProperties sentProperties = new StorageServiceProperties() + BlobServiceProperties sentProperties = new BlobServiceProperties() .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) .setDeleteRetentionPolicy(retentionPolicy) @@ -228,7 +228,7 @@ class ServiceAPITest extends APISpec { // Service properties may take up to 30s to take effect. If they weren't already in place, wait. sleepIfRecord(30 * 1000) - StorageServiceProperties receivedProperties = primaryBlobServiceClient.getProperties() + BlobServiceProperties receivedProperties = primaryBlobServiceClient.getProperties() then: headers.getValue("x-ms-request-id") != null @@ -258,7 +258,7 @@ class ServiceAPITest extends APISpec { .setIndexDocument("myIndex.html") .setErrorDocument404Path("custom/error/path.html") - StorageServiceProperties sentProperties = new StorageServiceProperties() + BlobServiceProperties sentProperties = new BlobServiceProperties() .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) .setDeleteRetentionPolicy(retentionPolicy) @@ -271,7 +271,7 @@ class ServiceAPITest extends APISpec { def "Set props error"() { when: getServiceClient(primaryCredential, "https://error.blob.core.windows.net") - .setProperties(new StorageServiceProperties()) + .setProperties(new BlobServiceProperties()) then: thrown(StorageException) diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 74946d46356e..f4b3c334abc7 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -34,7 +34,7 @@ sync-methods: none license-header: MICROSOFT_MIT_SMALL add-context-parameter: true models-subpackage: implementation.models -custom-types: AccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHTTPHeaders,BlobItem,BlobProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,ContainerItem,ContainerProperties,CopyStatusType,CorsRule,CpkInfo,CustomerProvidedKeyInfo,DataLakeStorageError,DataLakeStorageErrorError,DataLakeStorageErrorException,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobsIncludeItem,ListContainersIncludeType,Logging,Metrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,RetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,SignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,StorageError,StorageErrorCode,StorageErrorException,StorageServiceProperties,StorageServiceStats,SyncCopyStatusType,UserDelegationKey +custom-types: AccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHTTPHeaders,BlobContainerItem,BlobItem,BlobContainerProperties,BlobProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,CorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,Logging,Metrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,RetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,SignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,StorageError,StorageErrorCode,StorageErrorException,StorageServiceStats,SyncCopyStatusType,UserDelegationKey custom-types-subpackage: models ``` @@ -726,19 +726,6 @@ directive: } ``` -### ListContainersSegmentResponse -``` yaml -directive: -- from: swagger-document - where: $.definitions.ListContainersSegmentResponse - transform: > - if (!$.required.includes("Prefix")) { - $.required.push("Prefix"); - $.required.push("MaxResults"); - $.required.push("NextMarker"); - } -``` - ### SignedIdentifier ``` yaml directive: @@ -935,3 +922,84 @@ directive: $["202"] = response; } ``` + +### Rename ListContainersIncludeType to ListBlobContainersIncludeType +``` yaml +directive: +- from: swagger-document + where: $.parameters.ListContainersInclude + transform: > + $["x-ms-enum"].name = "ListBlobContainersIncludeType"; +``` + +### /?restype=service&comp=properties +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.BlobServiceProperties) { + $.BlobServiceProperties = $.StorageServiceProperties; + delete $.StorageServiceProperties; + $.BlobServiceProperties.xml = { "name": "StorageServiceProperties" }; + } + if (!$.BlobContainerProperties) { + $.BlobContainerProperties = $.ContainerProperties; + delete $.ContainerProperties; + } + if (!$.BlobContainerItem) { + $.BlobContainerItem = $.ContainerItem; + const path = $.BlobContainerItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobContainerProperties"); + $.BlobContainerItem.properties.Properties.$ref = path; + delete $.ContainerItem; + } +- from: swagger-document + where: $.parameters + transform: > + if (!$.BlobServiceProperties) { + const props = $.BlobServiceProperties = $.StorageServiceProperties; + props.name = "BlobServiceProperties"; + props.schema = { "$ref": props.schema.$ref.replace(/[#].*$/, "#/definitions/BlobServiceProperties") }; + delete $.StorageServiceProperties; + } +- from: swagger-document + where: $["x-ms-paths"]["/?restype=service&comp=properties"] + transform: > + const param = $.put.parameters[0]; + if (param && param["$ref"] && param["$ref"].endsWith("StorageServiceProperties")) { + const path = param["$ref"].replace(/[#].*$/, "#/parameters/BlobServiceProperties"); + $.put.parameters[0] = { "$ref": path }; + } + const def = $.get.responses["200"].schema; + if (def && def["$ref"] && def["$ref"].endsWith("StorageServiceProperties")) { + const path = def["$ref"].replace(/[#].*$/, "#/definitions/BlobServiceProperties"); + $.get.responses["200"].schema = { "$ref": path }; + } +``` + +### /?comp=list +``` yaml +directive: +- from: swagger-document + where: $.definitions + transform: > + if (!$.BlobContainersSegment) { + $.BlobContainersSegment = $.ListContainersSegmentResponse; + delete $.ListContainersSegmentResponse; + $.BlobContainersSegment["x-az-public"] = false; + $.BlobContainersSegment.required.push("NextMarker"); + $.BlobContainersSegment.properties.BlobContainerItems = $.BlobContainersSegment.properties.ContainerItems; + delete $.BlobContainersSegment.properties.ContainerItems; + const path = $.BlobContainersSegment.properties.BlobContainerItems.items.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItem"); + $.BlobContainersSegment.properties.BlobContainerItems.items.$ref = path; + } +- from: swagger-document + where: $["x-ms-paths"]["/?comp=list"] + transform: > + const def = $.get.responses["200"].schema; + if (def && def["$ref"] && !def["$ref"].endsWith("BlobContainersSegment")) { + const path = def["$ref"].replace(/[#].*$/, "#/definitions/BlobContainersSegment"); + $.get.responses["200"].schema = { "$ref": path }; + } + $.get.operationId = "Service_ListBlobContainersSegment"; +``` From 96e08b8dc3a1b160a5212e3bda081eddfabf3229 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 09/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From 5999a2363857eb8b74e3f3dd79c4878b82d1c807 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 10/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From 2802e3a037e9689085190f5f1e29c87d8483cd6e Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 11/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From 21e2d425e9c57df515c40f6255a6a50c3b677382 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 12/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../storage/blob/BlobServiceAsyncClient.java | 13 ++- .../blob/implementation/ServicesImpl.java | 8 +- .../models/BlobContainerItemProperties.java | 18 +-- .../azure-storage-blob/swagger/README.md | 105 +----------------- 4 files changed, 26 insertions(+), 118 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index 813adae3e363..5e012f5d4f5d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -35,6 +35,7 @@ import java.util.function.Function; import static com.azure.core.implementation.util.FluxUtil.withContext; +import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse; /** * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does @@ -245,10 +246,10 @@ private Mono listBlobContainersSegmen ListBlobContainersOptions options, Duration timeout) { options = options == null ? new ListBlobContainersOptions() : options; - return Utility.applyOptionalTimeout( + return postProcessResponse(Utility.applyOptionalTimeout( this.azureBlobStorage.services().listBlobContainersSegmentWithRestResponseAsync( - options.getPrefix(), marker, options.getMaxResultsPerPage(), options.getDetails().toIncludeType(), null, - null, Context.NONE), timeout); + options.getPrefix(), marker, options.getMaxResults(), options.getDetails().toIncludeType(), null, + null, Context.NONE), timeout)); } /** @@ -281,7 +282,8 @@ public Mono> getPropertiesWithResponse() { } Mono> getPropertiesWithResponse(Context context) { - return this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context) + return postProcessResponse( + this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, rb.getValue())); } @@ -319,7 +321,8 @@ public Mono> setPropertiesWithResponse(BlobServiceProperties prop } Mono> setPropertiesWithResponse(BlobServiceProperties properties, Context context) { - return this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context) + return postProcessResponse( + this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context)) .map(response -> new SimpleResponse<>(response, null)); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 404a6ebf51dd..7c0d53f56f09 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -29,7 +29,9 @@ import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersIncludeType; -import com.azure.storage.blob.models.StorageException; +import com.azure.storage.blob.models.StorageErrorException; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; @@ -69,7 +71,7 @@ public ServicesImpl(AzureBlobStorageImpl client) { private interface ServicesService { @Put("") @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(StorageException.class) + @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") BlobServiceProperties blobServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @Get("") @@ -84,7 +86,7 @@ private interface ServicesService { @Get("") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageException.class) + @UnexpectedResponseExceptionType(StorageErrorException.class) Mono listBlobContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListBlobContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); @Post("") diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java index 2d4c0929cad4..be2015f7aa13 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java @@ -13,7 +13,7 @@ /** * Properties of a container. */ -@JacksonXmlRootElement(localName = "Properties") +@JacksonXmlRootElement(localName = "BlobContainerProperties") @Fluent public final class BlobContainerItemProperties { /* @@ -81,7 +81,7 @@ public OffsetDateTime getLastModified() { * Set the lastModified property: The lastModified property. * * @param lastModified the lastModified value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { @@ -105,7 +105,7 @@ public String getEtag() { * Set the etag property: The etag property. * * @param etag the etag value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setEtag(String etag) { this.etag = etag; @@ -127,7 +127,7 @@ public LeaseStatusType getLeaseStatus() { * 'unlocked'. * * @param leaseStatus the leaseStatus value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; @@ -149,7 +149,7 @@ public LeaseStateType getLeaseState() { * 'leased', 'expired', 'breaking', 'broken'. * * @param leaseState the leaseState value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; @@ -171,7 +171,7 @@ public LeaseDurationType getLeaseDuration() { * 'fixed'. * * @param leaseDuration the leaseDuration value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; @@ -193,7 +193,7 @@ public PublicAccessType getPublicAccess() { * 'blob'. * * @param publicAccess the publicAccess value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setPublicAccess(PublicAccessType publicAccess) { this.publicAccess = publicAccess; @@ -215,7 +215,7 @@ public Boolean isHasImmutabilityPolicy() { * property. * * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setHasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { this.hasImmutabilityPolicy = hasImmutabilityPolicy; @@ -235,7 +235,7 @@ public Boolean isHasLegalHold() { * Set the hasLegalHold property: The hasLegalHold property. * * @param hasLegalHold the hasLegalHold value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setHasLegalHold(Boolean hasLegalHold) { this.hasLegalHold = hasLegalHold; diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 6c45fee7161b..f4b3c334abc7 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -34,7 +34,7 @@ sync-methods: none license-header: MICROSOFT_MIT_SMALL add-context-parameter: true models-subpackage: implementation.models -custom-types: AccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHTTPHeaders,BlobContainerItem,BlobItem,BlobContainerItemProperties,BlobProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,CorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,Logging,Metrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,RetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,SignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,StorageError,StorageErrorCode,StorageErrorException,StorageServiceStats,SyncCopyStatusType,UserDelegationKey +custom-types: AccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHTTPHeaders,BlobContainerItem,BlobItem,BlobContainerProperties,BlobProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,CorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,Logging,Metrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,RetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,SignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,StorageError,StorageErrorCode,StorageErrorException,StorageServiceStats,SyncCopyStatusType,UserDelegationKey custom-types-subpackage: models ``` @@ -943,36 +943,16 @@ directive: delete $.StorageServiceProperties; $.BlobServiceProperties.xml = { "name": "StorageServiceProperties" }; } - if (!$.BlobContainerItemProperties) { - $.BlobContainerItemProperties = $.ContainerProperties; + if (!$.BlobContainerProperties) { + $.BlobContainerProperties = $.ContainerProperties; delete $.ContainerProperties; - // - const etag = $.BlobContainerItemProperties.properties.Etag; - if (etag && !etag["x-ms-client-name"]) { - etag["x-ms-client-name"] = "eTag"; - $.BlobContainerItemProperties.properties.Etag = etag; - } } if (!$.BlobContainerItem) { $.BlobContainerItem = $.ContainerItem; - const path = $.BlobContainerItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItemProperties"); + const path = $.BlobContainerItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobContainerProperties"); $.BlobContainerItem.properties.Properties.$ref = path; delete $.ContainerItem; } - if (!$.BlobItemProperties) { - $.BlobItemProperties = $.BlobProperties; - delete $.BlobProperties; - // - const etag = $.BlobItemProperties.properties.Etag; - if (etag && !etag["x-ms-client-name"]) { - etag["x-ms-client-name"] = "eTag"; - $.BlobItemProperties.properties.Etag = etag; - } - } - if (!$.BlobItem) { - const path = $.BlobItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobItemProperties"); - $.BlobItem.properties.Properties.$ref = path; - } - from: swagger-document where: $.parameters transform: > @@ -1023,80 +1003,3 @@ directive: } $.get.operationId = "Service_ListBlobContainersSegment"; ``` - -### Change StorageErrorException to StorageException -``` yaml -directive: -- from: ServicesImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -- from: ContainersImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -- from: BlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -- from: AppendBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -- from: BlockBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -- from: PageBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -``` From c98d1057109552fb619466f572ebfcd9af77b564 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 13/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From abf985e3ed5619be21ef0bd8812f5276a2f05c70 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 14/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../storage/blob/BlobServiceAsyncClient.java | 13 ++- .../blob/implementation/ServicesImpl.java | 8 +- .../models/BlobContainerItemProperties.java | 18 +-- .../azure-storage-blob/swagger/README.md | 105 +----------------- 4 files changed, 26 insertions(+), 118 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index 813adae3e363..5e012f5d4f5d 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -35,6 +35,7 @@ import java.util.function.Function; import static com.azure.core.implementation.util.FluxUtil.withContext; +import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse; /** * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does @@ -245,10 +246,10 @@ private Mono listBlobContainersSegmen ListBlobContainersOptions options, Duration timeout) { options = options == null ? new ListBlobContainersOptions() : options; - return Utility.applyOptionalTimeout( + return postProcessResponse(Utility.applyOptionalTimeout( this.azureBlobStorage.services().listBlobContainersSegmentWithRestResponseAsync( - options.getPrefix(), marker, options.getMaxResultsPerPage(), options.getDetails().toIncludeType(), null, - null, Context.NONE), timeout); + options.getPrefix(), marker, options.getMaxResults(), options.getDetails().toIncludeType(), null, + null, Context.NONE), timeout)); } /** @@ -281,7 +282,8 @@ public Mono> getPropertiesWithResponse() { } Mono> getPropertiesWithResponse(Context context) { - return this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context) + return postProcessResponse( + this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, rb.getValue())); } @@ -319,7 +321,8 @@ public Mono> setPropertiesWithResponse(BlobServiceProperties prop } Mono> setPropertiesWithResponse(BlobServiceProperties properties, Context context) { - return this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context) + return postProcessResponse( + this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context)) .map(response -> new SimpleResponse<>(response, null)); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 404a6ebf51dd..7c0d53f56f09 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -29,7 +29,9 @@ import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersIncludeType; -import com.azure.storage.blob.models.StorageException; +import com.azure.storage.blob.models.StorageErrorException; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; @@ -69,7 +71,7 @@ public ServicesImpl(AzureBlobStorageImpl client) { private interface ServicesService { @Put("") @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(StorageException.class) + @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") BlobServiceProperties blobServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @Get("") @@ -84,7 +86,7 @@ private interface ServicesService { @Get("") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageException.class) + @UnexpectedResponseExceptionType(StorageErrorException.class) Mono listBlobContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListBlobContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); @Post("") diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java index 2d4c0929cad4..be2015f7aa13 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java @@ -13,7 +13,7 @@ /** * Properties of a container. */ -@JacksonXmlRootElement(localName = "Properties") +@JacksonXmlRootElement(localName = "BlobContainerProperties") @Fluent public final class BlobContainerItemProperties { /* @@ -81,7 +81,7 @@ public OffsetDateTime getLastModified() { * Set the lastModified property: The lastModified property. * * @param lastModified the lastModified value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { @@ -105,7 +105,7 @@ public String getEtag() { * Set the etag property: The etag property. * * @param etag the etag value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setEtag(String etag) { this.etag = etag; @@ -127,7 +127,7 @@ public LeaseStatusType getLeaseStatus() { * 'unlocked'. * * @param leaseStatus the leaseStatus value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; @@ -149,7 +149,7 @@ public LeaseStateType getLeaseState() { * 'leased', 'expired', 'breaking', 'broken'. * * @param leaseState the leaseState value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; @@ -171,7 +171,7 @@ public LeaseDurationType getLeaseDuration() { * 'fixed'. * * @param leaseDuration the leaseDuration value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; @@ -193,7 +193,7 @@ public PublicAccessType getPublicAccess() { * 'blob'. * * @param publicAccess the publicAccess value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setPublicAccess(PublicAccessType publicAccess) { this.publicAccess = publicAccess; @@ -215,7 +215,7 @@ public Boolean isHasImmutabilityPolicy() { * property. * * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setHasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { this.hasImmutabilityPolicy = hasImmutabilityPolicy; @@ -235,7 +235,7 @@ public Boolean isHasLegalHold() { * Set the hasLegalHold property: The hasLegalHold property. * * @param hasLegalHold the hasLegalHold value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setHasLegalHold(Boolean hasLegalHold) { this.hasLegalHold = hasLegalHold; diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 6c45fee7161b..f4b3c334abc7 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -34,7 +34,7 @@ sync-methods: none license-header: MICROSOFT_MIT_SMALL add-context-parameter: true models-subpackage: implementation.models -custom-types: AccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHTTPHeaders,BlobContainerItem,BlobItem,BlobContainerItemProperties,BlobProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,CorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,Logging,Metrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,RetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,SignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,StorageError,StorageErrorCode,StorageErrorException,StorageServiceStats,SyncCopyStatusType,UserDelegationKey +custom-types: AccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHTTPHeaders,BlobContainerItem,BlobItem,BlobContainerProperties,BlobProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,CorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,Logging,Metrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,RetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,SignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,StorageError,StorageErrorCode,StorageErrorException,StorageServiceStats,SyncCopyStatusType,UserDelegationKey custom-types-subpackage: models ``` @@ -943,36 +943,16 @@ directive: delete $.StorageServiceProperties; $.BlobServiceProperties.xml = { "name": "StorageServiceProperties" }; } - if (!$.BlobContainerItemProperties) { - $.BlobContainerItemProperties = $.ContainerProperties; + if (!$.BlobContainerProperties) { + $.BlobContainerProperties = $.ContainerProperties; delete $.ContainerProperties; - // - const etag = $.BlobContainerItemProperties.properties.Etag; - if (etag && !etag["x-ms-client-name"]) { - etag["x-ms-client-name"] = "eTag"; - $.BlobContainerItemProperties.properties.Etag = etag; - } } if (!$.BlobContainerItem) { $.BlobContainerItem = $.ContainerItem; - const path = $.BlobContainerItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItemProperties"); + const path = $.BlobContainerItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobContainerProperties"); $.BlobContainerItem.properties.Properties.$ref = path; delete $.ContainerItem; } - if (!$.BlobItemProperties) { - $.BlobItemProperties = $.BlobProperties; - delete $.BlobProperties; - // - const etag = $.BlobItemProperties.properties.Etag; - if (etag && !etag["x-ms-client-name"]) { - etag["x-ms-client-name"] = "eTag"; - $.BlobItemProperties.properties.Etag = etag; - } - } - if (!$.BlobItem) { - const path = $.BlobItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobItemProperties"); - $.BlobItem.properties.Properties.$ref = path; - } - from: swagger-document where: $.parameters transform: > @@ -1023,80 +1003,3 @@ directive: } $.get.operationId = "Service_ListBlobContainersSegment"; ``` - -### Change StorageErrorException to StorageException -``` yaml -directive: -- from: ServicesImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -- from: ContainersImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -- from: BlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -- from: AppendBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -- from: BlockBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -- from: PageBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.models.StorageErrorException", - "com.azure.storage.blob.models.StorageException" - ). - replace( - /StorageErrorException.class/g, - "StorageException.class" - ); -``` From 29ddf0e67f12e2ef0bf30cd2560ba4986732d39b Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 15/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From 05d27b338331da662bf8b27b9088f6ff9f8356a7 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 16/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../storage/blob/BlobServiceAsyncClient.java | 41 +-- .../azure/storage/blob/BlobServiceClient.java | 2 +- .../blob/implementation/ServicesImpl.java | 7 +- .../models/BlobContainerItemProperties.java | 20 +- .../blob/models/BlobServiceProperties.java | 10 +- ...ServiceAsyncClientJavaDocCodeSnippets.java | 15 +- .../BlobServiceClientJavaDocCodeSnippets.java | 14 +- .../com/azure/storage/blob/APISpec.groovy | 6 +- .../azure/storage/blob/ServiceAPITest.groovy | 19 +- .../azure-storage-blob/swagger/README.md | 259 +++--------------- 10 files changed, 100 insertions(+), 293 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index 6826cddd2630..efda84e32cf7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -19,12 +19,12 @@ import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse; import com.azure.storage.blob.models.BlobContainerItem; import com.azure.storage.blob.models.BlobServiceProperties; -import com.azure.storage.blob.models.BlobServiceStatistics; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.StorageServiceStats; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Utility; import reactor.core.publisher.Mono; @@ -34,9 +34,8 @@ import java.util.Map; import java.util.function.Function; -import static com.azure.core.implementation.util.FluxUtil.monoError; -import static com.azure.core.implementation.util.FluxUtil.pagedFluxError; import static com.azure.core.implementation.util.FluxUtil.withContext; +import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse; /** * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does @@ -272,10 +271,10 @@ private Mono listBlobContainersSegmen ListBlobContainersOptions options, Duration timeout) { options = options == null ? new ListBlobContainersOptions() : options; - return Utility.applyOptionalTimeout( + return postProcessResponse(Utility.applyOptionalTimeout( this.azureBlobStorage.services().listBlobContainersSegmentWithRestResponseAsync( - options.getPrefix(), marker, options.getMaxResultsPerPage(), options.getDetails().toIncludeType(), null, - null, Context.NONE), timeout); + options.getPrefix(), marker, options.getMaxResults(), options.getDetails().toIncludeType(), null, + null, Context.NONE), timeout)); } /** @@ -289,11 +288,7 @@ private Mono listBlobContainersSegmen * @return A reactive response containing the storage account properties. */ public Mono getProperties() { - try { - return getPropertiesWithResponse().flatMap(FluxUtil::toMono); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); } /** @@ -308,15 +303,12 @@ public Mono getProperties() { * account properties. */ public Mono> getPropertiesWithResponse() { - try { - return withContext(this::getPropertiesWithResponse); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return withContext(this::getPropertiesWithResponse); } Mono> getPropertiesWithResponse(Context context) { - return this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context) + return postProcessResponse( + this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, rb.getValue())); } @@ -334,11 +326,7 @@ Mono> getPropertiesWithResponse(Context context) * @return A {@link Mono} containing the storage account properties. */ public Mono setProperties(BlobServiceProperties properties) { - try { - return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); } /** @@ -354,15 +342,12 @@ public Mono setProperties(BlobServiceProperties properties) { * @return A {@link Mono} containing the storage account properties. */ public Mono> setPropertiesWithResponse(BlobServiceProperties properties) { - try { - return withContext(context -> setPropertiesWithResponse(properties, context)); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return withContext(context -> setPropertiesWithResponse(properties, context)); } Mono> setPropertiesWithResponse(BlobServiceProperties properties, Context context) { - return this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context) + return postProcessResponse( + this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context)) .map(response -> new SimpleResponse<>(response, null)); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index 9f7a682bdd39..7acf0a91c15c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -12,10 +12,10 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobContainerItem; import com.azure.storage.blob.models.BlobServiceProperties; -import com.azure.storage.blob.models.BlobServiceStatistics; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.StorageServiceStats; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Utility; import reactor.core.publisher.Mono; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 39d1ff4363f6..a082f1b318a4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -26,11 +26,10 @@ import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse; import com.azure.storage.blob.implementation.models.ServicesSetPropertiesResponse; import com.azure.storage.blob.implementation.models.ServicesSubmitBatchResponse; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersIncludeType; -import java.nio.ByteBuffer; +import com.azure.storage.blob.models.StorageErrorException; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -68,7 +67,7 @@ public ServicesImpl(AzureBlobStorageImpl client) { private interface ServicesService { @Put("") @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(BlobStorageException.class) + @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") BlobServiceProperties blobServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @Get("") @@ -83,7 +82,7 @@ private interface ServicesService { @Get("") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(BlobStorageException.class) + @UnexpectedResponseExceptionType(StorageErrorException.class) Mono listBlobContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListBlobContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); @Post("") diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java index 7e4fd0656cc6..a1fac90de400 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java @@ -13,7 +13,7 @@ /** * Properties of a container. */ -@JacksonXmlRootElement(localName = "BlobContainerItemProperties") +@JacksonXmlRootElement(localName = "BlobContainerProperties") @Fluent public final class BlobContainerItemProperties { /* @@ -81,7 +81,7 @@ public OffsetDateTime getLastModified() { * Set the lastModified property: The lastModified property. * * @param lastModified the lastModified value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { @@ -104,8 +104,8 @@ public String getETag() { /** * Set the eTag property: The eTag property. * - * @param eTag the eTag value to set. - * @return the BlobContainerItemProperties object itself. + * @param etag the etag value to set. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setETag(String eTag) { this.eTag = eTag; @@ -127,7 +127,7 @@ public LeaseStatusType getLeaseStatus() { * 'unlocked'. * * @param leaseStatus the leaseStatus value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; @@ -149,7 +149,7 @@ public LeaseStateType getLeaseState() { * 'leased', 'expired', 'breaking', 'broken'. * * @param leaseState the leaseState value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; @@ -171,7 +171,7 @@ public LeaseDurationType getLeaseDuration() { * 'fixed'. * * @param leaseDuration the leaseDuration value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; @@ -193,7 +193,7 @@ public PublicAccessType getPublicAccess() { * 'blob'. * * @param publicAccess the publicAccess value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setPublicAccess(PublicAccessType publicAccess) { this.publicAccess = publicAccess; @@ -215,7 +215,7 @@ public Boolean isHasImmutabilityPolicy() { * property. * * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setHasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { this.hasImmutabilityPolicy = hasImmutabilityPolicy; @@ -235,7 +235,7 @@ public Boolean isHasLegalHold() { * Set the hasLegalHold property: The hasLegalHold property. * * @param hasLegalHold the hasLegalHold value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setHasLegalHold(Boolean hasLegalHold) { this.hasLegalHold = hasLegalHold; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java index 73d7df042cc5..26391d2e497b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java @@ -87,7 +87,7 @@ public BlobAnalyticsLogging getLogging() { * @param logging the logging value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setLogging(BlobAnalyticsLogging logging) { + public BlobServiceProperties setLogging(Logging logging) { this.logging = logging; return this; } @@ -107,7 +107,7 @@ public BlobMetrics getHourMetrics() { * @param hourMetrics the hourMetrics value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setHourMetrics(BlobMetrics hourMetrics) { + public BlobServiceProperties setHourMetrics(Metrics hourMetrics) { this.hourMetrics = hourMetrics; return this; } @@ -127,7 +127,7 @@ public BlobMetrics getMinuteMetrics() { * @param minuteMetrics the minuteMetrics value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setMinuteMetrics(BlobMetrics minuteMetrics) { + public BlobServiceProperties setMinuteMetrics(Metrics minuteMetrics) { this.minuteMetrics = minuteMetrics; return this; } @@ -150,7 +150,7 @@ public List getCors() { * @param cors the cors value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setCors(List cors) { + public BlobServiceProperties setCors(List cors) { this.cors = new CorsWrapper(cors); return this; } @@ -198,7 +198,7 @@ public BlobRetentionPolicy getDeleteRetentionPolicy() { * @param deleteRetentionPolicy the deleteRetentionPolicy value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setDeleteRetentionPolicy(BlobRetentionPolicy deleteRetentionPolicy) { + public BlobServiceProperties setDeleteRetentionPolicy(RetentionPolicy deleteRetentionPolicy) { this.deleteRetentionPolicy = deleteRetentionPolicy; return this; } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java index c2c2b7167f3a..31e201cb8560 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java @@ -6,11 +6,10 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobAnalyticsLogging; import com.azure.storage.blob.models.BlobContainerListDetails; -import com.azure.storage.blob.models.BlobMetrics; -import com.azure.storage.blob.models.BlobRetentionPolicy; import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; +import com.azure.storage.blob.models.RetentionPolicy; import java.time.OffsetDateTime; import java.util.Collections; @@ -124,11 +123,11 @@ public void getPropertiesWithResponse() { */ public void setProperties() { // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#BlobServiceProperties - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) @@ -150,11 +149,11 @@ public void setProperties() { */ public void setPropertiesWithResponse() { // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#BlobServiceProperties - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java index 5f2b7f135608..887ffe3a29f7 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java @@ -6,8 +6,6 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobAnalyticsLogging; import com.azure.storage.blob.models.BlobContainerListDetails; -import com.azure.storage.blob.models.BlobMetrics; -import com.azure.storage.blob.models.BlobRetentionPolicy; import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; @@ -135,11 +133,11 @@ public void getPropertiesWithResponse() { */ public void setProperties() { // BEGIN: com.azure.storage.blob.BlobServiceClient.setProperties#BlobServiceProperties - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) @@ -164,11 +162,11 @@ public void setProperties() { */ public void setPropertiesWithResponse() { // BEGIN: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#BlobServiceProperties-Duration-Context - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy index 1de9221aad7c..4f43dac3c693 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy @@ -25,11 +25,11 @@ import com.azure.core.util.Configuration import com.azure.core.util.logging.ClientLogger import com.azure.identity.credential.EnvironmentCredentialBuilder import com.azure.storage.blob.models.BlobContainerItem -import com.azure.storage.blob.models.BlobRetentionPolicy import com.azure.storage.blob.models.BlobServiceProperties import com.azure.storage.blob.models.CopyStatusType import com.azure.storage.blob.models.LeaseStateType import com.azure.storage.blob.models.ListBlobContainersOptions +import com.azure.storage.blob.models.RetentionPolicy import com.azure.storage.blob.specialized.BlobAsyncClientBase import com.azure.storage.blob.specialized.BlobClientBase import com.azure.storage.blob.specialized.LeaseClient @@ -652,14 +652,14 @@ class APISpec extends Specification { def enableSoftDelete() { primaryBlobServiceClient.setProperties(new BlobServiceProperties() - .setDeleteRetentionPolicy(new BlobRetentionPolicy().setEnabled(true).setDays(2))) + .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(true).setDays(2))) sleepIfRecord(30000) } def disableSoftDelete() { primaryBlobServiceClient.setProperties(new BlobServiceProperties() - .setDeleteRetentionPolicy(new BlobRetentionPolicy().setEnabled(false))) + .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(false))) sleepIfRecord(30000) } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy index 235cc1e4d287..59af72c43c81 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy @@ -7,13 +7,14 @@ package com.azure.storage.blob import com.azure.storage.blob.models.BlobAnalyticsLogging import com.azure.storage.blob.models.BlobContainerItem import com.azure.storage.blob.models.BlobContainerListDetails -import com.azure.storage.blob.models.BlobCorsRule -import com.azure.storage.blob.models.BlobMetrics -import com.azure.storage.blob.models.BlobRetentionPolicy import com.azure.storage.blob.models.BlobServiceProperties +import com.azure.storage.blob.models.CorsRule import com.azure.storage.blob.models.ListBlobContainersOptions import com.azure.storage.blob.models.StaticWebsite -import com.azure.storage.blob.models.BlobStorageException +import com.azure.storage.blob.models.StorageAccountInfo +import com.azure.storage.blob.models.StorageException +import com.azure.storage.blob.models.StorageServiceStats +import com.azure.storage.blob.models.UserDelegationKey import com.azure.storage.common.credentials.SharedKeyCredential import com.azure.storage.common.policy.RequestRetryOptions import com.azure.storage.common.policy.RequestRetryPolicy @@ -23,7 +24,7 @@ import java.time.OffsetDateTime class ServiceAPITest extends APISpec { def setup() { - def disabled = new BlobRetentionPolicy().setEnabled(false) + RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setStaticWebsite(new StaticWebsite().setEnabled(false)) .setDeleteRetentionPolicy(disabled) @@ -38,7 +39,7 @@ class ServiceAPITest extends APISpec { } def cleanup() { - def disabled = new BlobRetentionPolicy().setEnabled(false) + RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setStaticWebsite(new StaticWebsite().setEnabled(false)) .setDeleteRetentionPolicy(disabled) @@ -216,7 +217,7 @@ class ServiceAPITest extends APISpec { .setIndexDocument("myIndex.html") .setErrorDocument404Path("custom/error/path.html") - def sentProperties = new BlobServiceProperties() + BlobServiceProperties sentProperties = new BlobServiceProperties() .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) .setDeleteRetentionPolicy(retentionPolicy) @@ -227,7 +228,7 @@ class ServiceAPITest extends APISpec { // Service properties may take up to 30s to take effect. If they weren't already in place, wait. sleepIfRecord(30 * 1000) - def receivedProperties = primaryBlobServiceClient.getProperties() + BlobServiceProperties receivedProperties = primaryBlobServiceClient.getProperties() then: headers.getValue("x-ms-request-id") != null @@ -257,7 +258,7 @@ class ServiceAPITest extends APISpec { .setIndexDocument("myIndex.html") .setErrorDocument404Path("custom/error/path.html") - def sentProperties = new BlobServiceProperties() + BlobServiceProperties sentProperties = new BlobServiceProperties() .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) .setDeleteRetentionPolicy(retentionPolicy) diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 28076bb1f114..71306698cc57 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -34,7 +34,7 @@ sync-methods: none license-header: MICROSOFT_MIT_SMALL add-context-parameter: true models-subpackage: implementation.models -custom-types: BlobAccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHttpHeaders,BlobContainerItem,BlobItem,BlobContainerItemProperties,BlobItemProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,BlobCorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,BlobAnalyticsLogging,BlobMetrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,BlobRetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,BlobSignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,BlobErrorCode,BlobServiceStatistics,SyncCopyStatusType,UserDelegationKey +custom-types: AccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHTTPHeaders,BlobContainerItem,BlobItem,BlobContainerProperties,BlobProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,CorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,Logging,Metrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,RetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,SignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,StorageError,StorageErrorCode,StorageErrorException,StorageServiceStats,SyncCopyStatusType,UserDelegationKey custom-types-subpackage: models ``` @@ -756,6 +756,21 @@ directive: } ``` +### SignedIdentifier +``` yaml +directive: +- from: swagger-document + where: $.definitions.SignedIdentifier + transform: > + if ($.xml) { + delete $.xml; + } +- from: swagger-document + where: $.definitions.SignedIdentifiers + transform: > + $.items.xml = { "name": "SignedIdentifier" } +``` + ### KeyInfo ``` yaml directive: @@ -947,129 +962,7 @@ directive: $["x-ms-enum"].name = "ListBlobContainersIncludeType"; ``` -### /?comp=list -``` yaml -directive: -- from: swagger-document - where: $.definitions - transform: > - if (!$.BlobContainersSegment) { - $.BlobContainersSegment = $.ListContainersSegmentResponse; - delete $.ListContainersSegmentResponse; - $.BlobContainersSegment["x-az-public"] = false; - $.BlobContainersSegment.required.push("NextMarker"); - $.BlobContainersSegment.properties.BlobContainerItems = $.BlobContainersSegment.properties.ContainerItems; - delete $.BlobContainersSegment.properties.ContainerItems; - const path = $.BlobContainersSegment.properties.BlobContainerItems.items.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItem"); - $.BlobContainersSegment.properties.BlobContainerItems.items.$ref = path; - } -- from: swagger-document - where: $["x-ms-paths"]["/?comp=list"] - transform: > - const def = $.get.responses["200"].schema; - if (def && def["$ref"] && !def["$ref"].endsWith("BlobContainersSegment")) { - const path = def["$ref"].replace(/[#].*$/, "#/definitions/BlobContainersSegment"); - $.get.responses["200"].schema = { "$ref": path }; - } - $.get.operationId = "Service_ListBlobContainersSegment"; -``` - -### Change StorageErrorException to StorageException -``` yaml -directive: -- from: ServicesImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: ContainersImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: BlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: AppendBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: BlockBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: PageBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -``` - -### GeoReplication -``` yaml -directive: -- from: swagger-document - where: $.definitions.GeoReplication.properties.Status - transform: > - $["x-ms-enum"].name = "GeoReplicationStatus"; -``` - -### BlobErrorCode -``` yaml -directive: -- from: swagger-document - where: $.definitions.ErrorCode - transform: > - $["x-ms-enum"].name = "BlobErrorCode"; -``` - -### BlobServiceProperties, BlobAnalyticsLogging, BlobMetrics, BlobCorsRule, and BlobRetentionPolicy +### /?restype=service&comp=properties ``` yaml directive: - from: swagger-document @@ -1080,32 +973,15 @@ directive: delete $.StorageServiceProperties; $.BlobServiceProperties.xml = { "name": "StorageServiceProperties" }; } - if (!$.BlobAnalyticsLogging) { - $.BlobAnalyticsLogging = $.Logging; - delete $.Logging; - $.BlobAnalyticsLogging.xml = {"name": "Logging"}; - $.BlobServiceProperties.properties.Logging["$ref"] = "#/definitions/BlobAnalyticsLogging"; - } - if (!$.BlobMetrics) { - $.BlobMetrics = $.Metrics; - delete $.Metrics; - $.BlobMetrics.xml = {"name": "Metrics"}; - $.BlobServiceProperties.properties.HourMetrics["$ref"] = "#/definitions/BlobMetrics"; - $.BlobServiceProperties.properties.MinuteMetrics["$ref"] = "#/definitions/BlobMetrics"; - } - if (!$.BlobCorsRule) { - $.BlobCorsRule = $.CorsRule; - delete $.CorsRule; - $.BlobCorsRule.xml = {"name": "CorsRule"}; - $.BlobServiceProperties.properties.Cors.items["$ref"] = "#/definitions/BlobCorsRule"; - } - if (!$.BlobRetentionPolicy) { - $.BlobRetentionPolicy = $.RetentionPolicy; - delete $.RetentionPolicy; - $.BlobRetentionPolicy.xml = {"name": "RetentionPolicy"}; - $.BlobAnalyticsLogging.properties.RetentionPolicy["$ref"] = "#/definitions/BlobRetentionPolicy"; - $.BlobMetrics.properties.RetentionPolicy["$ref"] = "#/definitions/BlobRetentionPolicy"; - $.BlobServiceProperties.properties.DeleteRetentionPolicy["$ref"] = "#/definitions/BlobRetentionPolicy"; + if (!$.BlobContainerProperties) { + $.BlobContainerProperties = $.ContainerProperties; + delete $.ContainerProperties; + } + if (!$.BlobContainerItem) { + $.BlobContainerItem = $.ContainerItem; + const path = $.BlobContainerItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobContainerProperties"); + $.BlobContainerItem.properties.Properties.$ref = path; + delete $.ContainerItem; } - from: swagger-document where: $.parameters @@ -1131,80 +1007,29 @@ directive: } ``` -### BlobServiceStatistics -``` yaml -directive: -- from: swagger-document - where: $.definitions - transform: > - if (!$.BlobServiceStatistics) { - $.BlobServiceStatistics = $.StorageServiceStats; - delete $.StorageServiceStats; - $.BlobServiceStatistics.xml = { "name": "StorageServiceStats" } - $.BlobServiceStatistics.description = "Statistics for the storage service."; - } -- from: swagger-document - where: $["x-ms-paths"]["/?restype=service&comp=stats"].get.responses["200"] - transform: > - if ($.schema && $.schema.$ref && $.schema.$ref.endsWith("StorageServiceStats")) { - const path = $.schema.$ref.replace(/[#].*$/, "#/definitions/BlobServiceStatistics"); - $.schema = { "$ref": path }; - } -``` - -### BlobAccessPolicy and BlobSignedIdentifier +### /?comp=list ``` yaml directive: - from: swagger-document where: $.definitions transform: > - if (!$.BlobSignedIdentifier) { - $.BlobSignedIdentifier = $.SignedIdentifier; - delete $.SignedIdentifier; - $.BlobSignedIdentifier.xml = {"name": "SignedIdentifier"}; - $.SignedIdentifiers.items["$ref"] = "#/definitions/BlobSignedIdentifier"; + if (!$.BlobContainersSegment) { + $.BlobContainersSegment = $.ListContainersSegmentResponse; + delete $.ListContainersSegmentResponse; + $.BlobContainersSegment["x-az-public"] = false; + $.BlobContainersSegment.required.push("NextMarker"); + $.BlobContainersSegment.properties.BlobContainerItems = $.BlobContainersSegment.properties.ContainerItems; + delete $.BlobContainersSegment.properties.ContainerItems; + const path = $.BlobContainersSegment.properties.BlobContainerItems.items.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItem"); + $.BlobContainersSegment.properties.BlobContainerItems.items.$ref = path; } - from: swagger-document - where: $.definitions + where: $["x-ms-paths"]["/?comp=list"] transform: > - if (!$.BlobAccessPolicy) { - $.BlobAccessPolicy = $.AccessPolicy; - delete $.AccessPolicy; - $.BlobAccessPolicy.xml = {"name": "AccessPolicy"}; - $.BlobAccessPolicy.properties.StartsOn = $.BlobAccessPolicy.properties.Start; - $.BlobAccessPolicy.properties.StartsOn.xml = {"name": "Start"}; - delete $.BlobAccessPolicy.properties.Start; - $.BlobAccessPolicy.properties.ExpiresOn = $.BlobAccessPolicy.properties.Expiry; - $.BlobAccessPolicy.properties.ExpiresOn.xml = {"name": "Expiry"}; - delete $.BlobAccessPolicy.properties.Expiry; - $.BlobAccessPolicy.properties.Permissions = $.BlobAccessPolicy.properties.Permission; - $.BlobAccessPolicy.properties.Permissions.xml = {"name": "Permission"}; - delete $.BlobAccessPolicy.properties.Permission; + const def = $.get.responses["200"].schema; + if (def && def["$ref"] && !def["$ref"].endsWith("BlobContainersSegment")) { + const path = def["$ref"].replace(/[#].*$/, "#/definitions/BlobContainersSegment"); + $.get.responses["200"].schema = { "$ref": path }; } - $.BlobSignedIdentifier.properties.AccessPolicy["$ref"] = "#/definitions/BlobAccessPolicy"; -``` - -### BlobServiceProperties Annotation Fix -``` yaml -directive: -- from: BlobServiceProperties.java - where: $ - transform: > - return $.replace('@JsonProperty(value = "Metrics")\n private BlobMetrics hourMetrics;', '@JsonProperty(value = "HourMetrics")\n private BlobMetrics hourMetrics;'). - replace('@JsonProperty(value = "Metrics")\n private BlobMetrics minuteMetrics;', '@JsonProperty(value = "MinuteMetrics")\n private BlobMetrics minuteMetrics;'). - replace('@JsonProperty(value = "RetentionPolicy")\n private BlobRetentionPolicy deleteRetentionPolicy;', '@JsonProperty(value = "DeleteRetentionPolicy")\n private BlobRetentionPolicy deleteRetentionPolicy;'); -``` - -### Rename BlobHttpHeaders to BlobHttpHeader -``` yaml -directive: -- from: swagger-document - where: $.parameters - transform: > - $.BlobCacheControl["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentDisposition["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentEncoding["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentLanguage["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentMD5["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentType["x-ms-parameter-grouping"].name = "blob-http-headers"; + $.get.operationId = "Service_ListBlobContainersSegment"; ``` From 72c86077ba74f6aa5a1a0b6a849f846ba94648cb Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 17/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../com/azure/storage/blob/implementation/ServicesImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index a082f1b318a4..3f7e014fafae 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -33,6 +33,10 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + /** * An instance of this class provides access to all the operations defined in * Services. From 44a344ce04ae0e6a6400673ac8948729c005226b Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 18/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From dd4f0079566f7f74defeaf6b80027c762ff6f443 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 19/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../storage/blob/BlobServiceAsyncClient.java | 41 +-- .../azure/storage/blob/BlobServiceClient.java | 2 +- .../blob/implementation/ServicesImpl.java | 7 +- .../models/BlobContainerItemProperties.java | 20 +- .../blob/models/BlobServiceProperties.java | 10 +- ...ServiceAsyncClientJavaDocCodeSnippets.java | 15 +- .../BlobServiceClientJavaDocCodeSnippets.java | 14 +- .../com/azure/storage/blob/APISpec.groovy | 6 +- .../azure/storage/blob/ServiceAPITest.groovy | 19 +- .../azure-storage-blob/swagger/README.md | 259 +++--------------- 10 files changed, 100 insertions(+), 293 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index 6826cddd2630..efda84e32cf7 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -19,12 +19,12 @@ import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse; import com.azure.storage.blob.models.BlobContainerItem; import com.azure.storage.blob.models.BlobServiceProperties; -import com.azure.storage.blob.models.BlobServiceStatistics; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.StorageServiceStats; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Utility; import reactor.core.publisher.Mono; @@ -34,9 +34,8 @@ import java.util.Map; import java.util.function.Function; -import static com.azure.core.implementation.util.FluxUtil.monoError; -import static com.azure.core.implementation.util.FluxUtil.pagedFluxError; import static com.azure.core.implementation.util.FluxUtil.withContext; +import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse; /** * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does @@ -272,10 +271,10 @@ private Mono listBlobContainersSegmen ListBlobContainersOptions options, Duration timeout) { options = options == null ? new ListBlobContainersOptions() : options; - return Utility.applyOptionalTimeout( + return postProcessResponse(Utility.applyOptionalTimeout( this.azureBlobStorage.services().listBlobContainersSegmentWithRestResponseAsync( - options.getPrefix(), marker, options.getMaxResultsPerPage(), options.getDetails().toIncludeType(), null, - null, Context.NONE), timeout); + options.getPrefix(), marker, options.getMaxResults(), options.getDetails().toIncludeType(), null, + null, Context.NONE), timeout)); } /** @@ -289,11 +288,7 @@ private Mono listBlobContainersSegmen * @return A reactive response containing the storage account properties. */ public Mono getProperties() { - try { - return getPropertiesWithResponse().flatMap(FluxUtil::toMono); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); } /** @@ -308,15 +303,12 @@ public Mono getProperties() { * account properties. */ public Mono> getPropertiesWithResponse() { - try { - return withContext(this::getPropertiesWithResponse); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return withContext(this::getPropertiesWithResponse); } Mono> getPropertiesWithResponse(Context context) { - return this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context) + return postProcessResponse( + this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, rb.getValue())); } @@ -334,11 +326,7 @@ Mono> getPropertiesWithResponse(Context context) * @return A {@link Mono} containing the storage account properties. */ public Mono setProperties(BlobServiceProperties properties) { - try { - return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); } /** @@ -354,15 +342,12 @@ public Mono setProperties(BlobServiceProperties properties) { * @return A {@link Mono} containing the storage account properties. */ public Mono> setPropertiesWithResponse(BlobServiceProperties properties) { - try { - return withContext(context -> setPropertiesWithResponse(properties, context)); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return withContext(context -> setPropertiesWithResponse(properties, context)); } Mono> setPropertiesWithResponse(BlobServiceProperties properties, Context context) { - return this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context) + return postProcessResponse( + this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context)) .map(response -> new SimpleResponse<>(response, null)); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index 9f7a682bdd39..7acf0a91c15c 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -12,10 +12,10 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobContainerItem; import com.azure.storage.blob.models.BlobServiceProperties; -import com.azure.storage.blob.models.BlobServiceStatistics; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.StorageServiceStats; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Utility; import reactor.core.publisher.Mono; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 39d1ff4363f6..a082f1b318a4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -26,11 +26,10 @@ import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse; import com.azure.storage.blob.implementation.models.ServicesSetPropertiesResponse; import com.azure.storage.blob.implementation.models.ServicesSubmitBatchResponse; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersIncludeType; -import java.nio.ByteBuffer; +import com.azure.storage.blob.models.StorageErrorException; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -68,7 +67,7 @@ public ServicesImpl(AzureBlobStorageImpl client) { private interface ServicesService { @Put("") @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(BlobStorageException.class) + @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") BlobServiceProperties blobServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @Get("") @@ -83,7 +82,7 @@ private interface ServicesService { @Get("") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(BlobStorageException.class) + @UnexpectedResponseExceptionType(StorageErrorException.class) Mono listBlobContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListBlobContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); @Post("") diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java index 7e4fd0656cc6..a1fac90de400 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java @@ -13,7 +13,7 @@ /** * Properties of a container. */ -@JacksonXmlRootElement(localName = "BlobContainerItemProperties") +@JacksonXmlRootElement(localName = "BlobContainerProperties") @Fluent public final class BlobContainerItemProperties { /* @@ -81,7 +81,7 @@ public OffsetDateTime getLastModified() { * Set the lastModified property: The lastModified property. * * @param lastModified the lastModified value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { @@ -104,8 +104,8 @@ public String getETag() { /** * Set the eTag property: The eTag property. * - * @param eTag the eTag value to set. - * @return the BlobContainerItemProperties object itself. + * @param etag the etag value to set. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setETag(String eTag) { this.eTag = eTag; @@ -127,7 +127,7 @@ public LeaseStatusType getLeaseStatus() { * 'unlocked'. * * @param leaseStatus the leaseStatus value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; @@ -149,7 +149,7 @@ public LeaseStateType getLeaseState() { * 'leased', 'expired', 'breaking', 'broken'. * * @param leaseState the leaseState value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; @@ -171,7 +171,7 @@ public LeaseDurationType getLeaseDuration() { * 'fixed'. * * @param leaseDuration the leaseDuration value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; @@ -193,7 +193,7 @@ public PublicAccessType getPublicAccess() { * 'blob'. * * @param publicAccess the publicAccess value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setPublicAccess(PublicAccessType publicAccess) { this.publicAccess = publicAccess; @@ -215,7 +215,7 @@ public Boolean isHasImmutabilityPolicy() { * property. * * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setHasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { this.hasImmutabilityPolicy = hasImmutabilityPolicy; @@ -235,7 +235,7 @@ public Boolean isHasLegalHold() { * Set the hasLegalHold property: The hasLegalHold property. * * @param hasLegalHold the hasLegalHold value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setHasLegalHold(Boolean hasLegalHold) { this.hasLegalHold = hasLegalHold; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java index 73d7df042cc5..26391d2e497b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java @@ -87,7 +87,7 @@ public BlobAnalyticsLogging getLogging() { * @param logging the logging value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setLogging(BlobAnalyticsLogging logging) { + public BlobServiceProperties setLogging(Logging logging) { this.logging = logging; return this; } @@ -107,7 +107,7 @@ public BlobMetrics getHourMetrics() { * @param hourMetrics the hourMetrics value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setHourMetrics(BlobMetrics hourMetrics) { + public BlobServiceProperties setHourMetrics(Metrics hourMetrics) { this.hourMetrics = hourMetrics; return this; } @@ -127,7 +127,7 @@ public BlobMetrics getMinuteMetrics() { * @param minuteMetrics the minuteMetrics value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setMinuteMetrics(BlobMetrics minuteMetrics) { + public BlobServiceProperties setMinuteMetrics(Metrics minuteMetrics) { this.minuteMetrics = minuteMetrics; return this; } @@ -150,7 +150,7 @@ public List getCors() { * @param cors the cors value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setCors(List cors) { + public BlobServiceProperties setCors(List cors) { this.cors = new CorsWrapper(cors); return this; } @@ -198,7 +198,7 @@ public BlobRetentionPolicy getDeleteRetentionPolicy() { * @param deleteRetentionPolicy the deleteRetentionPolicy value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setDeleteRetentionPolicy(BlobRetentionPolicy deleteRetentionPolicy) { + public BlobServiceProperties setDeleteRetentionPolicy(RetentionPolicy deleteRetentionPolicy) { this.deleteRetentionPolicy = deleteRetentionPolicy; return this; } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java index c2c2b7167f3a..31e201cb8560 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java @@ -6,11 +6,10 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobAnalyticsLogging; import com.azure.storage.blob.models.BlobContainerListDetails; -import com.azure.storage.blob.models.BlobMetrics; -import com.azure.storage.blob.models.BlobRetentionPolicy; import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; +import com.azure.storage.blob.models.RetentionPolicy; import java.time.OffsetDateTime; import java.util.Collections; @@ -124,11 +123,11 @@ public void getPropertiesWithResponse() { */ public void setProperties() { // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#BlobServiceProperties - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) @@ -150,11 +149,11 @@ public void setProperties() { */ public void setPropertiesWithResponse() { // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#BlobServiceProperties - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java index 5f2b7f135608..887ffe3a29f7 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java @@ -6,8 +6,6 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobAnalyticsLogging; import com.azure.storage.blob.models.BlobContainerListDetails; -import com.azure.storage.blob.models.BlobMetrics; -import com.azure.storage.blob.models.BlobRetentionPolicy; import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; @@ -135,11 +133,11 @@ public void getPropertiesWithResponse() { */ public void setProperties() { // BEGIN: com.azure.storage.blob.BlobServiceClient.setProperties#BlobServiceProperties - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) @@ -164,11 +162,11 @@ public void setProperties() { */ public void setPropertiesWithResponse() { // BEGIN: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#BlobServiceProperties-Duration-Context - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy index 1de9221aad7c..4f43dac3c693 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy @@ -25,11 +25,11 @@ import com.azure.core.util.Configuration import com.azure.core.util.logging.ClientLogger import com.azure.identity.credential.EnvironmentCredentialBuilder import com.azure.storage.blob.models.BlobContainerItem -import com.azure.storage.blob.models.BlobRetentionPolicy import com.azure.storage.blob.models.BlobServiceProperties import com.azure.storage.blob.models.CopyStatusType import com.azure.storage.blob.models.LeaseStateType import com.azure.storage.blob.models.ListBlobContainersOptions +import com.azure.storage.blob.models.RetentionPolicy import com.azure.storage.blob.specialized.BlobAsyncClientBase import com.azure.storage.blob.specialized.BlobClientBase import com.azure.storage.blob.specialized.LeaseClient @@ -652,14 +652,14 @@ class APISpec extends Specification { def enableSoftDelete() { primaryBlobServiceClient.setProperties(new BlobServiceProperties() - .setDeleteRetentionPolicy(new BlobRetentionPolicy().setEnabled(true).setDays(2))) + .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(true).setDays(2))) sleepIfRecord(30000) } def disableSoftDelete() { primaryBlobServiceClient.setProperties(new BlobServiceProperties() - .setDeleteRetentionPolicy(new BlobRetentionPolicy().setEnabled(false))) + .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(false))) sleepIfRecord(30000) } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy index 235cc1e4d287..59af72c43c81 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy @@ -7,13 +7,14 @@ package com.azure.storage.blob import com.azure.storage.blob.models.BlobAnalyticsLogging import com.azure.storage.blob.models.BlobContainerItem import com.azure.storage.blob.models.BlobContainerListDetails -import com.azure.storage.blob.models.BlobCorsRule -import com.azure.storage.blob.models.BlobMetrics -import com.azure.storage.blob.models.BlobRetentionPolicy import com.azure.storage.blob.models.BlobServiceProperties +import com.azure.storage.blob.models.CorsRule import com.azure.storage.blob.models.ListBlobContainersOptions import com.azure.storage.blob.models.StaticWebsite -import com.azure.storage.blob.models.BlobStorageException +import com.azure.storage.blob.models.StorageAccountInfo +import com.azure.storage.blob.models.StorageException +import com.azure.storage.blob.models.StorageServiceStats +import com.azure.storage.blob.models.UserDelegationKey import com.azure.storage.common.credentials.SharedKeyCredential import com.azure.storage.common.policy.RequestRetryOptions import com.azure.storage.common.policy.RequestRetryPolicy @@ -23,7 +24,7 @@ import java.time.OffsetDateTime class ServiceAPITest extends APISpec { def setup() { - def disabled = new BlobRetentionPolicy().setEnabled(false) + RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setStaticWebsite(new StaticWebsite().setEnabled(false)) .setDeleteRetentionPolicy(disabled) @@ -38,7 +39,7 @@ class ServiceAPITest extends APISpec { } def cleanup() { - def disabled = new BlobRetentionPolicy().setEnabled(false) + RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setStaticWebsite(new StaticWebsite().setEnabled(false)) .setDeleteRetentionPolicy(disabled) @@ -216,7 +217,7 @@ class ServiceAPITest extends APISpec { .setIndexDocument("myIndex.html") .setErrorDocument404Path("custom/error/path.html") - def sentProperties = new BlobServiceProperties() + BlobServiceProperties sentProperties = new BlobServiceProperties() .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) .setDeleteRetentionPolicy(retentionPolicy) @@ -227,7 +228,7 @@ class ServiceAPITest extends APISpec { // Service properties may take up to 30s to take effect. If they weren't already in place, wait. sleepIfRecord(30 * 1000) - def receivedProperties = primaryBlobServiceClient.getProperties() + BlobServiceProperties receivedProperties = primaryBlobServiceClient.getProperties() then: headers.getValue("x-ms-request-id") != null @@ -257,7 +258,7 @@ class ServiceAPITest extends APISpec { .setIndexDocument("myIndex.html") .setErrorDocument404Path("custom/error/path.html") - def sentProperties = new BlobServiceProperties() + BlobServiceProperties sentProperties = new BlobServiceProperties() .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) .setDeleteRetentionPolicy(retentionPolicy) diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 28076bb1f114..71306698cc57 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -34,7 +34,7 @@ sync-methods: none license-header: MICROSOFT_MIT_SMALL add-context-parameter: true models-subpackage: implementation.models -custom-types: BlobAccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHttpHeaders,BlobContainerItem,BlobItem,BlobContainerItemProperties,BlobItemProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,BlobCorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,BlobAnalyticsLogging,BlobMetrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,BlobRetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,BlobSignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,BlobErrorCode,BlobServiceStatistics,SyncCopyStatusType,UserDelegationKey +custom-types: AccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHTTPHeaders,BlobContainerItem,BlobItem,BlobContainerProperties,BlobProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,CorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,Logging,Metrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,RetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,SignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,StorageError,StorageErrorCode,StorageErrorException,StorageServiceStats,SyncCopyStatusType,UserDelegationKey custom-types-subpackage: models ``` @@ -756,6 +756,21 @@ directive: } ``` +### SignedIdentifier +``` yaml +directive: +- from: swagger-document + where: $.definitions.SignedIdentifier + transform: > + if ($.xml) { + delete $.xml; + } +- from: swagger-document + where: $.definitions.SignedIdentifiers + transform: > + $.items.xml = { "name": "SignedIdentifier" } +``` + ### KeyInfo ``` yaml directive: @@ -947,129 +962,7 @@ directive: $["x-ms-enum"].name = "ListBlobContainersIncludeType"; ``` -### /?comp=list -``` yaml -directive: -- from: swagger-document - where: $.definitions - transform: > - if (!$.BlobContainersSegment) { - $.BlobContainersSegment = $.ListContainersSegmentResponse; - delete $.ListContainersSegmentResponse; - $.BlobContainersSegment["x-az-public"] = false; - $.BlobContainersSegment.required.push("NextMarker"); - $.BlobContainersSegment.properties.BlobContainerItems = $.BlobContainersSegment.properties.ContainerItems; - delete $.BlobContainersSegment.properties.ContainerItems; - const path = $.BlobContainersSegment.properties.BlobContainerItems.items.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItem"); - $.BlobContainersSegment.properties.BlobContainerItems.items.$ref = path; - } -- from: swagger-document - where: $["x-ms-paths"]["/?comp=list"] - transform: > - const def = $.get.responses["200"].schema; - if (def && def["$ref"] && !def["$ref"].endsWith("BlobContainersSegment")) { - const path = def["$ref"].replace(/[#].*$/, "#/definitions/BlobContainersSegment"); - $.get.responses["200"].schema = { "$ref": path }; - } - $.get.operationId = "Service_ListBlobContainersSegment"; -``` - -### Change StorageErrorException to StorageException -``` yaml -directive: -- from: ServicesImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: ContainersImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: BlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: AppendBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: BlockBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: PageBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -``` - -### GeoReplication -``` yaml -directive: -- from: swagger-document - where: $.definitions.GeoReplication.properties.Status - transform: > - $["x-ms-enum"].name = "GeoReplicationStatus"; -``` - -### BlobErrorCode -``` yaml -directive: -- from: swagger-document - where: $.definitions.ErrorCode - transform: > - $["x-ms-enum"].name = "BlobErrorCode"; -``` - -### BlobServiceProperties, BlobAnalyticsLogging, BlobMetrics, BlobCorsRule, and BlobRetentionPolicy +### /?restype=service&comp=properties ``` yaml directive: - from: swagger-document @@ -1080,32 +973,15 @@ directive: delete $.StorageServiceProperties; $.BlobServiceProperties.xml = { "name": "StorageServiceProperties" }; } - if (!$.BlobAnalyticsLogging) { - $.BlobAnalyticsLogging = $.Logging; - delete $.Logging; - $.BlobAnalyticsLogging.xml = {"name": "Logging"}; - $.BlobServiceProperties.properties.Logging["$ref"] = "#/definitions/BlobAnalyticsLogging"; - } - if (!$.BlobMetrics) { - $.BlobMetrics = $.Metrics; - delete $.Metrics; - $.BlobMetrics.xml = {"name": "Metrics"}; - $.BlobServiceProperties.properties.HourMetrics["$ref"] = "#/definitions/BlobMetrics"; - $.BlobServiceProperties.properties.MinuteMetrics["$ref"] = "#/definitions/BlobMetrics"; - } - if (!$.BlobCorsRule) { - $.BlobCorsRule = $.CorsRule; - delete $.CorsRule; - $.BlobCorsRule.xml = {"name": "CorsRule"}; - $.BlobServiceProperties.properties.Cors.items["$ref"] = "#/definitions/BlobCorsRule"; - } - if (!$.BlobRetentionPolicy) { - $.BlobRetentionPolicy = $.RetentionPolicy; - delete $.RetentionPolicy; - $.BlobRetentionPolicy.xml = {"name": "RetentionPolicy"}; - $.BlobAnalyticsLogging.properties.RetentionPolicy["$ref"] = "#/definitions/BlobRetentionPolicy"; - $.BlobMetrics.properties.RetentionPolicy["$ref"] = "#/definitions/BlobRetentionPolicy"; - $.BlobServiceProperties.properties.DeleteRetentionPolicy["$ref"] = "#/definitions/BlobRetentionPolicy"; + if (!$.BlobContainerProperties) { + $.BlobContainerProperties = $.ContainerProperties; + delete $.ContainerProperties; + } + if (!$.BlobContainerItem) { + $.BlobContainerItem = $.ContainerItem; + const path = $.BlobContainerItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobContainerProperties"); + $.BlobContainerItem.properties.Properties.$ref = path; + delete $.ContainerItem; } - from: swagger-document where: $.parameters @@ -1131,80 +1007,29 @@ directive: } ``` -### BlobServiceStatistics -``` yaml -directive: -- from: swagger-document - where: $.definitions - transform: > - if (!$.BlobServiceStatistics) { - $.BlobServiceStatistics = $.StorageServiceStats; - delete $.StorageServiceStats; - $.BlobServiceStatistics.xml = { "name": "StorageServiceStats" } - $.BlobServiceStatistics.description = "Statistics for the storage service."; - } -- from: swagger-document - where: $["x-ms-paths"]["/?restype=service&comp=stats"].get.responses["200"] - transform: > - if ($.schema && $.schema.$ref && $.schema.$ref.endsWith("StorageServiceStats")) { - const path = $.schema.$ref.replace(/[#].*$/, "#/definitions/BlobServiceStatistics"); - $.schema = { "$ref": path }; - } -``` - -### BlobAccessPolicy and BlobSignedIdentifier +### /?comp=list ``` yaml directive: - from: swagger-document where: $.definitions transform: > - if (!$.BlobSignedIdentifier) { - $.BlobSignedIdentifier = $.SignedIdentifier; - delete $.SignedIdentifier; - $.BlobSignedIdentifier.xml = {"name": "SignedIdentifier"}; - $.SignedIdentifiers.items["$ref"] = "#/definitions/BlobSignedIdentifier"; + if (!$.BlobContainersSegment) { + $.BlobContainersSegment = $.ListContainersSegmentResponse; + delete $.ListContainersSegmentResponse; + $.BlobContainersSegment["x-az-public"] = false; + $.BlobContainersSegment.required.push("NextMarker"); + $.BlobContainersSegment.properties.BlobContainerItems = $.BlobContainersSegment.properties.ContainerItems; + delete $.BlobContainersSegment.properties.ContainerItems; + const path = $.BlobContainersSegment.properties.BlobContainerItems.items.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItem"); + $.BlobContainersSegment.properties.BlobContainerItems.items.$ref = path; } - from: swagger-document - where: $.definitions + where: $["x-ms-paths"]["/?comp=list"] transform: > - if (!$.BlobAccessPolicy) { - $.BlobAccessPolicy = $.AccessPolicy; - delete $.AccessPolicy; - $.BlobAccessPolicy.xml = {"name": "AccessPolicy"}; - $.BlobAccessPolicy.properties.StartsOn = $.BlobAccessPolicy.properties.Start; - $.BlobAccessPolicy.properties.StartsOn.xml = {"name": "Start"}; - delete $.BlobAccessPolicy.properties.Start; - $.BlobAccessPolicy.properties.ExpiresOn = $.BlobAccessPolicy.properties.Expiry; - $.BlobAccessPolicy.properties.ExpiresOn.xml = {"name": "Expiry"}; - delete $.BlobAccessPolicy.properties.Expiry; - $.BlobAccessPolicy.properties.Permissions = $.BlobAccessPolicy.properties.Permission; - $.BlobAccessPolicy.properties.Permissions.xml = {"name": "Permission"}; - delete $.BlobAccessPolicy.properties.Permission; + const def = $.get.responses["200"].schema; + if (def && def["$ref"] && !def["$ref"].endsWith("BlobContainersSegment")) { + const path = def["$ref"].replace(/[#].*$/, "#/definitions/BlobContainersSegment"); + $.get.responses["200"].schema = { "$ref": path }; } - $.BlobSignedIdentifier.properties.AccessPolicy["$ref"] = "#/definitions/BlobAccessPolicy"; -``` - -### BlobServiceProperties Annotation Fix -``` yaml -directive: -- from: BlobServiceProperties.java - where: $ - transform: > - return $.replace('@JsonProperty(value = "Metrics")\n private BlobMetrics hourMetrics;', '@JsonProperty(value = "HourMetrics")\n private BlobMetrics hourMetrics;'). - replace('@JsonProperty(value = "Metrics")\n private BlobMetrics minuteMetrics;', '@JsonProperty(value = "MinuteMetrics")\n private BlobMetrics minuteMetrics;'). - replace('@JsonProperty(value = "RetentionPolicy")\n private BlobRetentionPolicy deleteRetentionPolicy;', '@JsonProperty(value = "DeleteRetentionPolicy")\n private BlobRetentionPolicy deleteRetentionPolicy;'); -``` - -### Rename BlobHttpHeaders to BlobHttpHeader -``` yaml -directive: -- from: swagger-document - where: $.parameters - transform: > - $.BlobCacheControl["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentDisposition["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentEncoding["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentLanguage["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentMD5["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentType["x-ms-parameter-grouping"].name = "blob-http-headers"; + $.get.operationId = "Service_ListBlobContainersSegment"; ``` From a3758843d18eb0c938d32a8fb90cf5906d83c7cc Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 20/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../com/azure/storage/blob/implementation/ServicesImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index a082f1b318a4..3f7e014fafae 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -33,6 +33,10 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + /** * An instance of this class provides access to all the operations defined in * Services. From 14df7c947ab4360bfe2f90765b331ed78a75eb71 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 21/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../com/azure/storage/blob/implementation/ServicesImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 3f7e014fafae..a082f1b318a4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -33,10 +33,6 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - /** * An instance of this class provides access to all the operations defined in * Services. From a38b3532da56512df67258117f88d81070ef5116 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 22/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../com/azure/storage/blob/implementation/ServicesImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index a082f1b318a4..3f7e014fafae 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -33,6 +33,10 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + /** * An instance of this class provides access to all the operations defined in * Services. From b92309c284ee0eb6c38aedf122627727fd4ee2c3 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2019 05:01:34 +0000 Subject: [PATCH 23/31] Generated from 8cb028d8acfe861317992cff12232d4bbfc3a795 (#453) chore: jsonfmt consumption --- .../resource-manager/v2017_11_30/pom.xml | 133 ++++++ .../consumption/v2017_11_30/Datagrain.java | 41 ++ .../consumption/v2017_11_30/ErrorDetails.java | 47 ++ .../v2017_11_30/ErrorResponse.java | 44 ++ .../v2017_11_30/ErrorResponseException.java | 44 ++ .../consumption/v2017_11_30/MeterDetails.java | 126 ++++++ .../consumption/v2017_11_30/Operation.java | 30 ++ .../v2017_11_30/OperationDisplay.java | 62 +++ .../consumption/v2017_11_30/Operations.java | 27 ++ .../v2017_11_30/ReservationDetails.java | 83 ++++ .../v2017_11_30/ReservationSummaries.java | 88 ++++ .../v2017_11_30/ReservationsDetails.java | 29 ++ .../v2017_11_30/ReservationsSummaries.java | 29 ++ .../consumption/v2017_11_30/UsageDetail.java | 153 +++++++ .../consumption/v2017_11_30/UsageDetails.java | 28 ++ .../ConsumptionManagementClientImpl.java | 238 ++++++++++ .../implementation/ConsumptionManager.java | 135 ++++++ .../implementation/IdParsingUtils.java | 57 +++ .../implementation/OperationImpl.java | 37 ++ .../implementation/OperationInner.java | 59 +++ .../implementation/OperationsImpl.java | 49 ++ .../implementation/OperationsInner.java | 283 ++++++++++++ .../v2017_11_30/implementation/PageImpl.java | 75 ++++ .../v2017_11_30/implementation/PageImpl1.java | 75 ++++ .../ReservationDetailsImpl.java | 89 ++++ .../ReservationDetailsInner.java | 169 +++++++ .../ReservationSummariesImpl.java | 94 ++++ .../ReservationSummariesInner.java | 188 ++++++++ .../ReservationsDetailsImpl.java | 49 ++ .../ReservationsDetailsInner.java | 149 +++++++ .../ReservationsSummariesImpl.java | 50 +++ .../ReservationsSummariesInner.java | 236 ++++++++++ .../implementation/UsageDetailImpl.java | 160 +++++++ .../implementation/UsageDetailInner.java | 372 ++++++++++++++++ .../implementation/UsageDetailsImpl.java | 49 ++ .../implementation/UsageDetailsInner.java | 421 ++++++++++++++++++ .../implementation/package-info.java | 11 + .../consumption/v2017_11_30/package-info.java | 11 + 38 files changed, 4020 insertions(+) create mode 100644 consumption/resource-manager/v2017_11_30/pom.xml create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java create mode 100644 consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java diff --git a/consumption/resource-manager/v2017_11_30/pom.xml b/consumption/resource-manager/v2017_11_30/pom.xml new file mode 100644 index 000000000000..726dbd0cd9e5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.consumption.v2017_11_30 + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.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 + + + + + + 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java new file mode 100644 index 000000000000..7277266367d4 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Datagrain.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Datagrain. + */ +public final class Datagrain extends ExpandableStringEnum { + /** Static value daily for Datagrain. */ + public static final Datagrain DAILY_GRAIN = fromString("daily"); + + /** Static value monthly for Datagrain. */ + public static final Datagrain MONTHLY_GRAIN = fromString("monthly"); + + /** + * Creates or finds a Datagrain from its string representation. + * @param name a name to look for + * @return the corresponding Datagrain + */ + @JsonCreator + public static Datagrain fromString(String name) { + return fromString(name, Datagrain.class); + } + + /** + * @return known Datagrain values + */ + public static Collection values() { + return values(Datagrain.class); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java new file mode 100644 index 000000000000..061d3707777f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorDetails.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java new file mode 100644 index 000000000000..4b60d6c4b56a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java new file mode 100644 index 000000000000..6810c79da797 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/MeterDetails.java new file mode 100644 index 000000000000..8b0e9a5c9f89 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30; + +import java.math.BigDecimal; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the meter detail. + */ +public class MeterDetails { + /** + * The name of the meter, within the given meter category. + */ + @JsonProperty(value = "meterName", access = JsonProperty.Access.WRITE_ONLY) + private String meterName; + + /** + * The category of the meter, for example, 'Cloud services', 'Networking', + * etc.. + */ + @JsonProperty(value = "meterCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterCategory; + + /** + * The subcategory of the meter, for example, 'A6 Cloud services', + * 'ExpressRoute (IXP)', etc.. + */ + @JsonProperty(value = "meterSubCategory", access = JsonProperty.Access.WRITE_ONLY) + private String meterSubCategory; + + /** + * The unit in which the meter consumption is charged, for example, + * 'Hours', 'GB', etc. + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /** + * The location in which the Azure service is available. + */ + @JsonProperty(value = "meterLocation", access = JsonProperty.Access.WRITE_ONLY) + private String meterLocation; + + /** + * The total included quantity associated with the offer. + */ + @JsonProperty(value = "totalIncludedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalIncludedQuantity; + + /** + * The pretax listing price. + */ + @JsonProperty(value = "pretaxStandardRate", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxStandardRate; + + /** + * 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java new file mode 100644 index 000000000000..31404c2f9027 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java new file mode 100644 index 000000000000..f447cecef2f6 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Consumption. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: UsageDetail, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Consumption. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: UsageDetail, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java new file mode 100644 index 000000000000..46db4bd82ac9 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java new file mode 100644 index 000000000000..425aa1b30228 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationDetails.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationDetailsInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationDetails. + */ +public interface ReservationDetails extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceId value. + */ + String instanceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the totalReservedQuantity value. + */ + BigDecimal totalReservedQuantity(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java new file mode 100644 index 000000000000..0da465497b92 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationSummaries.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationSummariesInner; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ReservationSummaries. + */ +public interface ReservationSummaries extends HasInner, HasManager { + /** + * @return the avgUtilizationPercentage value. + */ + BigDecimal avgUtilizationPercentage(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the maxUtilizationPercentage value. + */ + BigDecimal maxUtilizationPercentage(); + + /** + * @return the minUtilizationPercentage value. + */ + BigDecimal minUtilizationPercentage(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationId value. + */ + String reservationId(); + + /** + * @return the reservationOrderId value. + */ + String reservationOrderId(); + + /** + * @return the reservedHours value. + */ + BigDecimal reservedHours(); + + /** + * @return the skuName value. + */ + String skuName(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the usageDate value. + */ + DateTime usageDate(); + + /** + * @return the usedHours value. + */ + BigDecimal usedHours(); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java new file mode 100644 index 000000000000..610547625e4f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsDetails.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsDetails. + */ +public interface ReservationsDetails extends HasInner { + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, String filter); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java new file mode 100644 index 000000000000..093913eb70bc --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/ReservationsSummaries.java @@ -0,0 +1,29 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ReservationsSummariesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ReservationsSummaries. + */ +public interface ReservationsSummaries extends HasInner { + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String scope, Datagrain grain); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java new file mode 100644 index 000000000000..65d426de1175 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetail.java @@ -0,0 +1,153 @@ +/** + * 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.v2017_11_30; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.ConsumptionManager; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailInner; +import java.math.BigDecimal; +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 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. + */ + String meterId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the pretaxCost value. + */ + BigDecimal pretaxCost(); + + /** + * @return the product value. + */ + String product(); + + /** + * @return the subscriptionGuid value. + */ + String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java new file mode 100644 index 000000000000..09edc5e655c5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/UsageDetails.java @@ -0,0 +1,28 @@ +/** + * 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.v2017_11_30; + +import rx.Observable; +import com.microsoft.azure.management.consumption.v2017_11_30.implementation.UsageDetailsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing UsageDetails. + */ +public interface UsageDetails extends HasInner { + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String scope); + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManagementClientImpl.java new file mode 100644 index 000000000000..e90cbf30307e --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the ConsumptionManagementClientImpl class. + */ +public class ConsumptionManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Version of the API to be used with the client request. The current version is 2017-11-30. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-11-30. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public ConsumptionManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The UsageDetailsInner object to access its operations. + */ + private UsageDetailsInner usageDetails; + + /** + * Gets the UsageDetailsInner object to access its operations. + * @return the UsageDetailsInner object. + */ + public UsageDetailsInner usageDetails() { + return this.usageDetails; + } + + /** + * The ReservationsSummariesInner object to access its operations. + */ + private ReservationsSummariesInner reservationsSummaries; + + /** + * Gets the ReservationsSummariesInner object to access its operations. + * @return the ReservationsSummariesInner object. + */ + public ReservationsSummariesInner reservationsSummaries() { + return this.reservationsSummaries; + } + + /** + * The ReservationsDetailsInner object to access its operations. + */ + private ReservationsDetailsInner reservationsDetails; + + /** + * Gets the ReservationsDetailsInner object to access its operations. + * @return the ReservationsDetailsInner object. + */ + public ReservationsDetailsInner reservationsDetails() { + return this.reservationsDetails; + } + + /** + * The 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 = "2017-11-30"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.usageDetails = new UsageDetailsInner(restClient().retrofit(), this); + this.reservationsSummaries = new ReservationsSummariesInner(restClient().retrofit(), this); + this.reservationsDetails = new ReservationsDetailsInner(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", "2017-11-30"); + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ConsumptionManager.java new file mode 100644 index 000000000000..cb9bab5b437c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/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.v2017_11_30.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import com.microsoft.azure.management.consumption.v2017_11_30.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 UsageDetails usageDetails; + private ReservationsSummaries reservationsSummaries; + private ReservationsDetails reservationsDetails; + 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 UsageDetails. + */ + public UsageDetails usageDetails() { + if (this.usageDetails == null) { + this.usageDetails = new UsageDetailsImpl(this); + } + return this.usageDetails; + } + + /** + * @return Entry point to manage ReservationsSummaries. + */ + public ReservationsSummaries reservationsSummaries() { + if (this.reservationsSummaries == null) { + this.reservationsSummaries = new ReservationsSummariesImpl(this); + } + return this.reservationsSummaries; + } + + /** + * @return Entry point to manage ReservationsDetails. + */ + public ReservationsDetails reservationsDetails() { + if (this.reservationsDetails == null) { + this.reservationsDetails = new ReservationsDetailsImpl(this); + } + return this.reservationsDetails; + } + + /** + * @return Entry point to manage 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ef9c049995c8 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java new file mode 100644 index 000000000000..755a860e0eb5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final ConsumptionManager manager; + OperationImpl(OperationInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java new file mode 100644 index 000000000000..7760cef54fa7 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Consumption REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b2b9f88769ea --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final ConsumptionManager manager; + + OperationsImpl(ConsumptionManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java new file mode 100644 index 000000000000..c120301d5044 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations list" }) + @GET("providers/Microsoft.Consumption/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available consumption REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java new file mode 100644 index 000000000000..40913b6f3c7f --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java new file mode 100644 index 000000000000..b27ebf71e8f5 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/PageImpl1.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java new file mode 100644 index 000000000000..fad75759ed04 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationDetailsImpl extends WrapperImpl implements ReservationDetails { + private final ConsumptionManager manager; + ReservationDetailsImpl(ReservationDetailsInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String instanceId() { + return this.inner().instanceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public BigDecimal totalReservedQuantity() { + return this.inner().totalReservedQuantity(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java new file mode 100644 index 000000000000..90318875534c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationDetailsInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation details resource. + */ +@JsonFlatten +public class ReservationDetailsInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved for the day. E.g. if reservation for 1 + * instance was made on 1 PM, this will be 11 hours for that day and 24 + * hours from subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * The date on which consumption occurred. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * This is the total hours used by the instance. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This identifier is the name of the resource or the fully qualified + * Resource ID. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * This is the total count of instances that are reserved for the + * reservationId. + */ + @JsonProperty(value = "properties.totalReservedQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal totalReservedQuantity; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved for the day. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get the date on which consumption occurred. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get this is the total hours used by the instance. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this identifier is the name of the resource or the fully qualified Resource ID. + * + * @return the instanceId value + */ + public String instanceId() { + return this.instanceId; + } + + /** + * Get this is the total count of instances that are reserved for the reservationId. + * + * @return the totalReservedQuantity value + */ + public BigDecimal totalReservedQuantity() { + return this.totalReservedQuantity; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java new file mode 100644 index 000000000000..f0213c683ccb --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesImpl.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import java.util.Map; +import org.joda.time.DateTime; + +class ReservationSummariesImpl extends WrapperImpl implements ReservationSummaries { + private final ConsumptionManager manager; + ReservationSummariesImpl(ReservationSummariesInner inner, ConsumptionManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public BigDecimal avgUtilizationPercentage() { + return this.inner().avgUtilizationPercentage(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public BigDecimal maxUtilizationPercentage() { + return this.inner().maxUtilizationPercentage(); + } + + @Override + public BigDecimal minUtilizationPercentage() { + return this.inner().minUtilizationPercentage(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reservationId() { + return this.inner().reservationId(); + } + + @Override + public String reservationOrderId() { + return this.inner().reservationOrderId(); + } + + @Override + public BigDecimal reservedHours() { + return this.inner().reservedHours(); + } + + @Override + public String skuName() { + return this.inner().skuName(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DateTime usageDate() { + return this.inner().usageDate(); + } + + @Override + public BigDecimal usedHours() { + return this.inner().usedHours(); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java new file mode 100644 index 000000000000..b576830387c2 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationSummariesInner.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; + +import java.math.BigDecimal; +import org.joda.time.DateTime; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * reservation summaries resource. + */ +@JsonFlatten +public class ReservationSummariesInner extends ProxyResource { + /** + * The reservation order ID is the identifier for a reservation purchase. + * Each reservation order ID represents a single purchase transaction. A + * reservation order contains reservations. The reservation order specifies + * the VM size and region for the reservations. + */ + @JsonProperty(value = "properties.reservationOrderId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationOrderId; + + /** + * The reservation ID is the identifier of a reservation within a + * reservation order. Each reservation is the grouping for applying the + * benefit scope and also specifies the number of instances to which the + * reservation benefit can be applied to. + */ + @JsonProperty(value = "properties.reservationId", access = JsonProperty.Access.WRITE_ONLY) + private String reservationId; + + /** + * This is the ARM Sku name. It can be used to join with the serviceType + * field in additional info in usage records. + */ + @JsonProperty(value = "properties.skuName", access = JsonProperty.Access.WRITE_ONLY) + private String skuName; + + /** + * This is the total hours reserved. E.g. if reservation for 1 instance was + * made on 1 PM, this will be 11 hours for that day and 24 hours from + * subsequent days. + */ + @JsonProperty(value = "properties.reservedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal reservedHours; + + /** + * Data corresponding to the utilization record. If the grain of data is + * monthly, it will be first day of month. + */ + @JsonProperty(value = "properties.usageDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageDate; + + /** + * Total used hours by the reservation. + */ + @JsonProperty(value = "properties.usedHours", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usedHours; + + /** + * This is the minimum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 10%, this field will return 10% for that day. + */ + @JsonProperty(value = "properties.minUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal minUtilizationPercentage; + + /** + * This is average utilization for the entire time range. (day or month + * depending on the grain). + */ + @JsonProperty(value = "properties.avgUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal avgUtilizationPercentage; + + /** + * This is the maximum hourly utilization in the usage time (day or month). + * E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 + * and 5, utilization was 100%, this field will return 100% for that day. + */ + @JsonProperty(value = "properties.maxUtilizationPercentage", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal maxUtilizationPercentage; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags", access = JsonProperty.Access.WRITE_ONLY) + private Map tags; + + /** + * Get the reservation order ID is the identifier for a reservation purchase. Each reservation order ID represents a single purchase transaction. A reservation order contains reservations. The reservation order specifies the VM size and region for the reservations. + * + * @return the reservationOrderId value + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Get the reservation ID is the identifier of a reservation within a reservation order. Each reservation is the grouping for applying the benefit scope and also specifies the number of instances to which the reservation benefit can be applied to. + * + * @return the reservationId value + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Get this is the ARM Sku name. It can be used to join with the serviceType field in additional info in usage records. + * + * @return the skuName value + */ + public String skuName() { + return this.skuName; + } + + /** + * Get this is the total hours reserved. E.g. if reservation for 1 instance was made on 1 PM, this will be 11 hours for that day and 24 hours from subsequent days. + * + * @return the reservedHours value + */ + public BigDecimal reservedHours() { + return this.reservedHours; + } + + /** + * Get data corresponding to the utilization record. If the grain of data is monthly, it will be first day of month. + * + * @return the usageDate value + */ + public DateTime usageDate() { + return this.usageDate; + } + + /** + * Get total used hours by the reservation. + * + * @return the usedHours value + */ + public BigDecimal usedHours() { + return this.usedHours; + } + + /** + * Get this is the minimum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 10%, this field will return 10% for that day. + * + * @return the minUtilizationPercentage value + */ + public BigDecimal minUtilizationPercentage() { + return this.minUtilizationPercentage; + } + + /** + * Get this is average utilization for the entire time range. (day or month depending on the grain). + * + * @return the avgUtilizationPercentage value + */ + public BigDecimal avgUtilizationPercentage() { + return this.avgUtilizationPercentage; + } + + /** + * Get this is the maximum hourly utilization in the usage time (day or month). E.g. if usage record corresponds to 12/10/2017 and on that for hour 4 and 5, utilization was 100%, this field will return 100% for that day. + * + * @return the maxUtilizationPercentage value + */ + public BigDecimal maxUtilizationPercentage() { + return this.maxUtilizationPercentage; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.java new file mode 100644 index 000000000000..fc17d3e6c75c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationDetails; + +class ReservationsDetailsImpl extends WrapperImpl implements ReservationsDetails { + private final ConsumptionManager manager; + + ReservationsDetailsImpl(ConsumptionManager manager) { + super(manager.inner().reservationsDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, String filter) { + ReservationsDetailsInner client = this.inner(); + return client.listAsync(scope, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationDetails call(ReservationDetailsInner inner) { + return new ReservationDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java new file mode 100644 index 000000000000..9387cdeed173 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsDetailsInner.java @@ -0,0 +1,149 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsDetails. + */ +public class ReservationsDetailsInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsDetailsService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsDetailsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsDetailsInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsDetailsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsDetails to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsDetailsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationDetailsInner> object if successful. + */ + public List list(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, filter), serviceCallback); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable> listAsync(String scope, String filter) { + return listWithServiceResponseAsync(scope, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations details for provided date range. + * + * @param scope The scope of the reservation details. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param filter Filter reservation details by date range. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java new file mode 100644 index 000000000000..1499ddf7b318 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.consumption.v2017_11_30.ReservationSummaries; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; + +class ReservationsSummariesImpl extends WrapperImpl implements ReservationsSummaries { + private final ConsumptionManager manager; + + ReservationsSummariesImpl(ConsumptionManager manager) { + super(manager.inner().reservationsSummaries()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(String scope, Datagrain grain) { + ReservationsSummariesInner client = this.inner(); + return client.listAsync(scope, grain) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ReservationSummaries call(ReservationSummariesInner inner) { + return new ReservationSummariesImpl(inner, manager()); + } + }); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java new file mode 100644 index 000000000000..3deccb8ffe5a --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/ReservationsSummariesInner.java @@ -0,0 +1,236 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.consumption.v2017_11_30.Datagrain; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +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 ReservationsSummaries. + */ +public class ReservationsSummariesInner { + /** The Retrofit service to perform REST calls. */ + private ReservationsSummariesService service; + /** The service client containing this operation class. */ + private ConsumptionManagementClientImpl client; + + /** + * Initializes an instance of ReservationsSummariesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ReservationsSummariesInner(Retrofit retrofit, ConsumptionManagementClientImpl client) { + this.service = retrofit.create(ReservationsSummariesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ReservationsSummaries to be + * used by Retrofit to perform actually REST calls. + */ + interface ReservationsSummariesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.ReservationsSummaries list" }) + @GET("{scope}/providers/Microsoft.Consumption/reservationSummaries") + Observable> list(@Path(value = "scope", encoded = true) String scope, @Query("grain") Datagrain grain, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain) { + return listWithServiceResponseAsync(scope, grain).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(scope, grain, 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 reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ReservationSummariesInner> object if successful. + */ + public List list(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).toBlocking().single().body(); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(String scope, Datagrain grain, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(scope, grain, filter), serviceCallback); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable> listAsync(String scope, Datagrain grain, String filter) { + return listWithServiceResponseAsync(scope, grain, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the reservations summaries for daily or monthly grain. + * + * @param scope The scope of the reservation summaries. The scope can be 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}' or 'providers/Microsoft.Capacity/reservationorders/{ReservationOrderId}/reservations/{ReservationId}' + * @param grain Can be daily or monthly. Possible values include: 'DailyGrain', 'MonthlyGrain' + * @param filter Required only for daily grain. The properties/UsageDate for start date and end date. The filter supports 'le' and 'ge' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ReservationSummariesInner> object + */ + public Observable>> listWithServiceResponseAsync(String scope, Datagrain grain, String filter) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope is required and cannot be null."); + } + if (grain == null) { + throw new IllegalArgumentException("Parameter grain is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(scope, grain, 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java new file mode 100644 index 000000000000..04fa0e278504 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailImpl.java @@ -0,0 +1,160 @@ +/** + * 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.v2017_11_30.implementation; + +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +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 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 String meterId() { + return this.inner().meterId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public BigDecimal pretaxCost() { + return this.inner().pretaxCost(); + } + + @Override + public String product() { + return this.inner().product(); + } + + @Override + public String 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java new file mode 100644 index 000000000000..c349c1d93c44 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailInner.java @@ -0,0 +1,372 @@ +/** + * 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.v2017_11_30.implementation; + +import org.joda.time.DateTime; +import java.math.BigDecimal; +import com.microsoft.azure.management.consumption.v2017_11_30.MeterDetails; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An usage detail resource. + */ +@JsonFlatten +public class UsageDetailInner extends ProxyResource { + /** + * The id of the billing period resource that the usage belongs to. + */ + @JsonProperty(value = "properties.billingPeriodId", access = JsonProperty.Access.WRITE_ONLY) + private String billingPeriodId; + + /** + * The id of the invoice resource that the usage belongs to. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /** + * The start of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageStart", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageStart; + + /** + * The end of the date time range covered by the usage detail. + */ + @JsonProperty(value = "properties.usageEnd", access = JsonProperty.Access.WRITE_ONLY) + private DateTime usageEnd; + + /** + * The name of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceName", access = JsonProperty.Access.WRITE_ONLY) + private String instanceName; + + /** + * The uri of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceId", access = JsonProperty.Access.WRITE_ONLY) + private String instanceId; + + /** + * The location of the resource instance that the usage is about. + */ + @JsonProperty(value = "properties.instanceLocation", access = JsonProperty.Access.WRITE_ONLY) + private String instanceLocation; + + /** + * The ISO currency in which the meter is charged, for example, USD. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The quantity of usage. + */ + @JsonProperty(value = "properties.usageQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal usageQuantity; + + /** + * The billable usage quantity. + */ + @JsonProperty(value = "properties.billableQuantity", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal billableQuantity; + + /** + * The amount of cost before tax. + */ + @JsonProperty(value = "properties.pretaxCost", access = JsonProperty.Access.WRITE_ONLY) + private BigDecimal pretaxCost; + + /** + * The estimated usage is subject to change. + */ + @JsonProperty(value = "properties.isEstimated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEstimated; + + /** + * The meter id. + */ + @JsonProperty(value = "properties.meterId", access = JsonProperty.Access.WRITE_ONLY) + private String 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 String 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; + + /** + * 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. + * + * @return the meterId value + */ + public String 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 String 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 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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.java new file mode 100644 index 000000000000..a7c984a011d3 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsImpl.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.v2017_11_30.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.consumption.v2017_11_30.UsageDetail; + +class UsageDetailsImpl extends WrapperImpl implements UsageDetails { + private final ConsumptionManager manager; + + UsageDetailsImpl(ConsumptionManager manager) { + super(manager.inner().usageDetails()); + this.manager = manager; + } + + public ConsumptionManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String scope) { + UsageDetailsInner client = this.inner(); + return client.listAsync(scope) + .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/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java new file mode 100644 index 000000000000..7cfa1bba436c --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/UsageDetailsInner.java @@ -0,0 +1,421 @@ +/** + * 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.v2017_11_30.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.consumption.v2017_11_30.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2017_11_30.UsageDetails list" }) + @GET("{scope}/providers/Microsoft.Consumption/usageDetails") + Observable> list(@Path(value = "scope", encoded = true) String scope, @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, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.consumption.v2017_11_30.UsageDetails listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope) { + ServiceResponse> response = listSinglePageAsync(scope).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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 scope, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope) { + return listWithServiceResponseAsync(scope) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope) { + return listSinglePageAsync(scope) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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; + return service.list(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the usage details for a scope by billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @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 scope, final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(scope, expand, filter, skiptoken, top).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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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 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 scope, final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(scope, expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable> listAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(scope, expand, filter, skiptoken, top) + .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 scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + * @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'. + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UsageDetailInner> object + */ + public Observable>> listWithServiceResponseAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(scope, expand, filter, skiptoken, top) + .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 billing period. Usage details are available via this API only for May 1, 2014 or later. + * + ServiceResponse> * @param scope The scope of the usage details. The scope can be '/subscriptions/{subscriptionId}' for a subscription, or '/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}' for a billing period. + 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'. + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UsageDetailInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String scope, final String expand, final String filter, final String skiptoken, final Integer top) { + if (scope == null) { + throw new IllegalArgumentException("Parameter scope 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(scope, expand, filter, skiptoken, top, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 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 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 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 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 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); + } + +} diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java new file mode 100644 index 000000000000..5c1ce6320080 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30.implementation; diff --git a/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java new file mode 100644 index 000000000000..5debd4c360c1 --- /dev/null +++ b/consumption/resource-manager/v2017_11_30/src/main/java/com/microsoft/azure/management/consumption/v2017_11_30/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for ConsumptionManagementClient. + * Consumption management client provides access to consumption resources for Azure Enterprise Subscriptions. + */ +package com.microsoft.azure.management.consumption.v2017_11_30; From fc02ddebabb3be58bdd0e1ebf01c8bdd2b7b72e4 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 24/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../storage/blob/BlobServiceAsyncClient.java | 41 +-- .../azure/storage/blob/BlobServiceClient.java | 2 +- .../blob/implementation/ServicesImpl.java | 7 +- .../models/BlobContainerItemProperties.java | 20 +- .../blob/models/BlobServiceProperties.java | 10 +- ...ServiceAsyncClientJavaDocCodeSnippets.java | 15 +- .../BlobServiceClientJavaDocCodeSnippets.java | 14 +- .../com/azure/storage/blob/APISpec.groovy | 6 +- .../azure/storage/blob/ServiceAPITest.groovy | 19 +- .../azure-storage-blob/swagger/README.md | 259 +++--------------- 10 files changed, 100 insertions(+), 293 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index 34f24ff792ab..c12a6bcc4985 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -19,12 +19,12 @@ import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse; import com.azure.storage.blob.models.BlobContainerItem; import com.azure.storage.blob.models.BlobServiceProperties; -import com.azure.storage.blob.models.BlobServiceStatistics; import com.azure.storage.blob.models.CpkInfo; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.StorageServiceStats; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Utility; import reactor.core.publisher.Mono; @@ -34,9 +34,8 @@ import java.util.Map; import java.util.function.Function; -import static com.azure.core.implementation.util.FluxUtil.monoError; -import static com.azure.core.implementation.util.FluxUtil.pagedFluxError; import static com.azure.core.implementation.util.FluxUtil.withContext; +import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse; /** * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does @@ -282,10 +281,10 @@ private Mono listBlobContainersSegmen ListBlobContainersOptions options, Duration timeout) { options = options == null ? new ListBlobContainersOptions() : options; - return Utility.applyOptionalTimeout( + return postProcessResponse(Utility.applyOptionalTimeout( this.azureBlobStorage.services().listBlobContainersSegmentWithRestResponseAsync( - options.getPrefix(), marker, options.getMaxResultsPerPage(), options.getDetails().toIncludeType(), null, - null, Context.NONE), timeout); + options.getPrefix(), marker, options.getMaxResults(), options.getDetails().toIncludeType(), null, + null, Context.NONE), timeout)); } /** @@ -299,11 +298,7 @@ private Mono listBlobContainersSegmen * @return A reactive response containing the storage account properties. */ public Mono getProperties() { - try { - return getPropertiesWithResponse().flatMap(FluxUtil::toMono); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return getPropertiesWithResponse().flatMap(FluxUtil::toMono); } /** @@ -318,15 +313,12 @@ public Mono getProperties() { * account properties. */ public Mono> getPropertiesWithResponse() { - try { - return withContext(this::getPropertiesWithResponse); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return withContext(this::getPropertiesWithResponse); } Mono> getPropertiesWithResponse(Context context) { - return this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context) + return postProcessResponse( + this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context)) .map(rb -> new SimpleResponse<>(rb, rb.getValue())); } @@ -344,11 +336,7 @@ Mono> getPropertiesWithResponse(Context context) * @return A {@link Mono} containing the storage account properties. */ public Mono setProperties(BlobServiceProperties properties) { - try { - return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono); } /** @@ -364,15 +352,12 @@ public Mono setProperties(BlobServiceProperties properties) { * @return A {@link Mono} containing the storage account properties. */ public Mono> setPropertiesWithResponse(BlobServiceProperties properties) { - try { - return withContext(context -> setPropertiesWithResponse(properties, context)); - } catch (RuntimeException ex) { - return monoError(logger, ex); - } + return withContext(context -> setPropertiesWithResponse(properties, context)); } Mono> setPropertiesWithResponse(BlobServiceProperties properties, Context context) { - return this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context) + return postProcessResponse( + this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context)) .map(response -> new SimpleResponse<>(response, null)); } diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index 59b4ac8134d2..13b6463bbb34 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -12,10 +12,10 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobContainerItem; import com.azure.storage.blob.models.BlobServiceProperties; -import com.azure.storage.blob.models.BlobServiceStatistics; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.StorageAccountInfo; +import com.azure.storage.blob.models.StorageServiceStats; import com.azure.storage.blob.models.UserDelegationKey; import com.azure.storage.common.Utility; import reactor.core.publisher.Mono; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 39d1ff4363f6..a082f1b318a4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -26,11 +26,10 @@ import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse; import com.azure.storage.blob.implementation.models.ServicesSetPropertiesResponse; import com.azure.storage.blob.implementation.models.ServicesSubmitBatchResponse; -import com.azure.storage.blob.models.BlobStorageException; import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListBlobContainersIncludeType; -import java.nio.ByteBuffer; +import com.azure.storage.blob.models.StorageErrorException; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -68,7 +67,7 @@ public ServicesImpl(AzureBlobStorageImpl client) { private interface ServicesService { @Put("") @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(BlobStorageException.class) + @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") BlobServiceProperties blobServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @Get("") @@ -83,7 +82,7 @@ private interface ServicesService { @Get("") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(BlobStorageException.class) + @UnexpectedResponseExceptionType(StorageErrorException.class) Mono listBlobContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListBlobContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); @Post("") diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java index 7e4fd0656cc6..a1fac90de400 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobContainerItemProperties.java @@ -13,7 +13,7 @@ /** * Properties of a container. */ -@JacksonXmlRootElement(localName = "BlobContainerItemProperties") +@JacksonXmlRootElement(localName = "BlobContainerProperties") @Fluent public final class BlobContainerItemProperties { /* @@ -81,7 +81,7 @@ public OffsetDateTime getLastModified() { * Set the lastModified property: The lastModified property. * * @param lastModified the lastModified value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLastModified(OffsetDateTime lastModified) { if (lastModified == null) { @@ -104,8 +104,8 @@ public String getETag() { /** * Set the eTag property: The eTag property. * - * @param eTag the eTag value to set. - * @return the BlobContainerItemProperties object itself. + * @param etag the etag value to set. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setETag(String eTag) { this.eTag = eTag; @@ -127,7 +127,7 @@ public LeaseStatusType getLeaseStatus() { * 'unlocked'. * * @param leaseStatus the leaseStatus value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseStatus(LeaseStatusType leaseStatus) { this.leaseStatus = leaseStatus; @@ -149,7 +149,7 @@ public LeaseStateType getLeaseState() { * 'leased', 'expired', 'breaking', 'broken'. * * @param leaseState the leaseState value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseState(LeaseStateType leaseState) { this.leaseState = leaseState; @@ -171,7 +171,7 @@ public LeaseDurationType getLeaseDuration() { * 'fixed'. * * @param leaseDuration the leaseDuration value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setLeaseDuration(LeaseDurationType leaseDuration) { this.leaseDuration = leaseDuration; @@ -193,7 +193,7 @@ public PublicAccessType getPublicAccess() { * 'blob'. * * @param publicAccess the publicAccess value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setPublicAccess(PublicAccessType publicAccess) { this.publicAccess = publicAccess; @@ -215,7 +215,7 @@ public Boolean isHasImmutabilityPolicy() { * property. * * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setHasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { this.hasImmutabilityPolicy = hasImmutabilityPolicy; @@ -235,7 +235,7 @@ public Boolean isHasLegalHold() { * Set the hasLegalHold property: The hasLegalHold property. * * @param hasLegalHold the hasLegalHold value to set. - * @return the BlobContainerItemProperties object itself. + * @return the BlobContainerProperties object itself. */ public BlobContainerItemProperties setHasLegalHold(Boolean hasLegalHold) { this.hasLegalHold = hasLegalHold; diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java index 73d7df042cc5..26391d2e497b 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobServiceProperties.java @@ -87,7 +87,7 @@ public BlobAnalyticsLogging getLogging() { * @param logging the logging value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setLogging(BlobAnalyticsLogging logging) { + public BlobServiceProperties setLogging(Logging logging) { this.logging = logging; return this; } @@ -107,7 +107,7 @@ public BlobMetrics getHourMetrics() { * @param hourMetrics the hourMetrics value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setHourMetrics(BlobMetrics hourMetrics) { + public BlobServiceProperties setHourMetrics(Metrics hourMetrics) { this.hourMetrics = hourMetrics; return this; } @@ -127,7 +127,7 @@ public BlobMetrics getMinuteMetrics() { * @param minuteMetrics the minuteMetrics value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setMinuteMetrics(BlobMetrics minuteMetrics) { + public BlobServiceProperties setMinuteMetrics(Metrics minuteMetrics) { this.minuteMetrics = minuteMetrics; return this; } @@ -150,7 +150,7 @@ public List getCors() { * @param cors the cors value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setCors(List cors) { + public BlobServiceProperties setCors(List cors) { this.cors = new CorsWrapper(cors); return this; } @@ -198,7 +198,7 @@ public BlobRetentionPolicy getDeleteRetentionPolicy() { * @param deleteRetentionPolicy the deleteRetentionPolicy value to set. * @return the BlobServiceProperties object itself. */ - public BlobServiceProperties setDeleteRetentionPolicy(BlobRetentionPolicy deleteRetentionPolicy) { + public BlobServiceProperties setDeleteRetentionPolicy(RetentionPolicy deleteRetentionPolicy) { this.deleteRetentionPolicy = deleteRetentionPolicy; return this; } diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java index c2c2b7167f3a..31e201cb8560 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceAsyncClientJavaDocCodeSnippets.java @@ -6,11 +6,10 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobAnalyticsLogging; import com.azure.storage.blob.models.BlobContainerListDetails; -import com.azure.storage.blob.models.BlobMetrics; -import com.azure.storage.blob.models.BlobRetentionPolicy; import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; +import com.azure.storage.blob.models.RetentionPolicy; import java.time.OffsetDateTime; import java.util.Collections; @@ -124,11 +123,11 @@ public void getPropertiesWithResponse() { */ public void setProperties() { // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setProperties#BlobServiceProperties - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) @@ -150,11 +149,11 @@ public void setProperties() { */ public void setPropertiesWithResponse() { // BEGIN: com.azure.storage.blob.BlobServiceAsyncClient.setPropertiesWithResponse#BlobServiceProperties - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) diff --git a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java index 5f2b7f135608..887ffe3a29f7 100644 --- a/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobServiceClientJavaDocCodeSnippets.java @@ -6,8 +6,6 @@ import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobAnalyticsLogging; import com.azure.storage.blob.models.BlobContainerListDetails; -import com.azure.storage.blob.models.BlobMetrics; -import com.azure.storage.blob.models.BlobRetentionPolicy; import com.azure.storage.blob.models.BlobServiceProperties; import com.azure.storage.blob.models.ListBlobContainersOptions; import com.azure.storage.blob.models.PublicAccessType; @@ -135,11 +133,11 @@ public void getPropertiesWithResponse() { */ public void setProperties() { // BEGIN: com.azure.storage.blob.BlobServiceClient.setProperties#BlobServiceProperties - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) @@ -164,11 +162,11 @@ public void setProperties() { */ public void setPropertiesWithResponse() { // BEGIN: com.azure.storage.blob.BlobServiceClient.setPropertiesWithResponse#BlobServiceProperties-Duration-Context - BlobRetentionPolicy loggingRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(3); - BlobRetentionPolicy metricsRetentionPolicy = new BlobRetentionPolicy().setEnabled(true).setDays(1); + RetentionPolicy loggingRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(3); + RetentionPolicy metricsRetentionPolicy = new RetentionPolicy().setEnabled(true).setDays(1); BlobServiceProperties properties = new BlobServiceProperties() - .setLogging(new BlobAnalyticsLogging() + .setLogging(new Logging() .setWrite(true) .setDelete(true) .setRetentionPolicy(loggingRetentionPolicy)) diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy index 1de9221aad7c..4f43dac3c693 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy @@ -25,11 +25,11 @@ import com.azure.core.util.Configuration import com.azure.core.util.logging.ClientLogger import com.azure.identity.credential.EnvironmentCredentialBuilder import com.azure.storage.blob.models.BlobContainerItem -import com.azure.storage.blob.models.BlobRetentionPolicy import com.azure.storage.blob.models.BlobServiceProperties import com.azure.storage.blob.models.CopyStatusType import com.azure.storage.blob.models.LeaseStateType import com.azure.storage.blob.models.ListBlobContainersOptions +import com.azure.storage.blob.models.RetentionPolicy import com.azure.storage.blob.specialized.BlobAsyncClientBase import com.azure.storage.blob.specialized.BlobClientBase import com.azure.storage.blob.specialized.LeaseClient @@ -652,14 +652,14 @@ class APISpec extends Specification { def enableSoftDelete() { primaryBlobServiceClient.setProperties(new BlobServiceProperties() - .setDeleteRetentionPolicy(new BlobRetentionPolicy().setEnabled(true).setDays(2))) + .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(true).setDays(2))) sleepIfRecord(30000) } def disableSoftDelete() { primaryBlobServiceClient.setProperties(new BlobServiceProperties() - .setDeleteRetentionPolicy(new BlobRetentionPolicy().setEnabled(false))) + .setDeleteRetentionPolicy(new RetentionPolicy().setEnabled(false))) sleepIfRecord(30000) } diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy index 235cc1e4d287..59af72c43c81 100644 --- a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy @@ -7,13 +7,14 @@ package com.azure.storage.blob import com.azure.storage.blob.models.BlobAnalyticsLogging import com.azure.storage.blob.models.BlobContainerItem import com.azure.storage.blob.models.BlobContainerListDetails -import com.azure.storage.blob.models.BlobCorsRule -import com.azure.storage.blob.models.BlobMetrics -import com.azure.storage.blob.models.BlobRetentionPolicy import com.azure.storage.blob.models.BlobServiceProperties +import com.azure.storage.blob.models.CorsRule import com.azure.storage.blob.models.ListBlobContainersOptions import com.azure.storage.blob.models.StaticWebsite -import com.azure.storage.blob.models.BlobStorageException +import com.azure.storage.blob.models.StorageAccountInfo +import com.azure.storage.blob.models.StorageException +import com.azure.storage.blob.models.StorageServiceStats +import com.azure.storage.blob.models.UserDelegationKey import com.azure.storage.common.credentials.SharedKeyCredential import com.azure.storage.common.policy.RequestRetryOptions import com.azure.storage.common.policy.RequestRetryPolicy @@ -23,7 +24,7 @@ import java.time.OffsetDateTime class ServiceAPITest extends APISpec { def setup() { - def disabled = new BlobRetentionPolicy().setEnabled(false) + RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setStaticWebsite(new StaticWebsite().setEnabled(false)) .setDeleteRetentionPolicy(disabled) @@ -38,7 +39,7 @@ class ServiceAPITest extends APISpec { } def cleanup() { - def disabled = new BlobRetentionPolicy().setEnabled(false) + RetentionPolicy disabled = new RetentionPolicy().setEnabled(false) primaryBlobServiceClient.setProperties(new BlobServiceProperties() .setStaticWebsite(new StaticWebsite().setEnabled(false)) .setDeleteRetentionPolicy(disabled) @@ -216,7 +217,7 @@ class ServiceAPITest extends APISpec { .setIndexDocument("myIndex.html") .setErrorDocument404Path("custom/error/path.html") - def sentProperties = new BlobServiceProperties() + BlobServiceProperties sentProperties = new BlobServiceProperties() .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) .setDeleteRetentionPolicy(retentionPolicy) @@ -227,7 +228,7 @@ class ServiceAPITest extends APISpec { // Service properties may take up to 30s to take effect. If they weren't already in place, wait. sleepIfRecord(30 * 1000) - def receivedProperties = primaryBlobServiceClient.getProperties() + BlobServiceProperties receivedProperties = primaryBlobServiceClient.getProperties() then: headers.getValue("x-ms-request-id") != null @@ -257,7 +258,7 @@ class ServiceAPITest extends APISpec { .setIndexDocument("myIndex.html") .setErrorDocument404Path("custom/error/path.html") - def sentProperties = new BlobServiceProperties() + BlobServiceProperties sentProperties = new BlobServiceProperties() .setLogging(logging).setCors(corsRules).setDefaultServiceVersion(defaultServiceVersion) .setMinuteMetrics(minuteMetrics).setHourMetrics(hourMetrics) .setDeleteRetentionPolicy(retentionPolicy) diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index 28076bb1f114..71306698cc57 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -34,7 +34,7 @@ sync-methods: none license-header: MICROSOFT_MIT_SMALL add-context-parameter: true models-subpackage: implementation.models -custom-types: BlobAccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHttpHeaders,BlobContainerItem,BlobItem,BlobContainerItemProperties,BlobItemProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,BlobCorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,BlobAnalyticsLogging,BlobMetrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,BlobRetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,BlobSignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,BlobErrorCode,BlobServiceStatistics,SyncCopyStatusType,UserDelegationKey +custom-types: AccessPolicy,AccessTier,AccountKind,AppendPositionAccessConditions,ArchiveStatus,BlobDownloadHeaders,BlobHTTPHeaders,BlobContainerItem,BlobItem,BlobContainerProperties,BlobProperties,BlobServiceProperties,BlobType,Block,BlockList,BlockListType,BlockLookupList,BlobPrefix,ClearRange,CopyStatusType,CorsRule,CpkInfo,CustomerProvidedKeyInfo,DeleteSnapshotsOptionType,EncryptionAlgorithmType,FilterBlobsItem,GeoReplication,GeoReplicationStatusType,KeyInfo,LeaseAccessConditions,LeaseDurationType,LeaseStateType,LeaseStatusType,ListBlobContainersIncludeType,ListBlobsIncludeItem,Logging,Metrics,ModifiedAccessConditions,PageList,PageRange,PathRenameMode,PublicAccessType,RehydratePriority,RetentionPolicy,SequenceNumberAccessConditions,SequenceNumberActionType,SignedIdentifier,SkuName,SourceModifiedAccessConditions,StaticWebsite,StorageError,StorageErrorCode,StorageErrorException,StorageServiceStats,SyncCopyStatusType,UserDelegationKey custom-types-subpackage: models ``` @@ -756,6 +756,21 @@ directive: } ``` +### SignedIdentifier +``` yaml +directive: +- from: swagger-document + where: $.definitions.SignedIdentifier + transform: > + if ($.xml) { + delete $.xml; + } +- from: swagger-document + where: $.definitions.SignedIdentifiers + transform: > + $.items.xml = { "name": "SignedIdentifier" } +``` + ### KeyInfo ``` yaml directive: @@ -947,129 +962,7 @@ directive: $["x-ms-enum"].name = "ListBlobContainersIncludeType"; ``` -### /?comp=list -``` yaml -directive: -- from: swagger-document - where: $.definitions - transform: > - if (!$.BlobContainersSegment) { - $.BlobContainersSegment = $.ListContainersSegmentResponse; - delete $.ListContainersSegmentResponse; - $.BlobContainersSegment["x-az-public"] = false; - $.BlobContainersSegment.required.push("NextMarker"); - $.BlobContainersSegment.properties.BlobContainerItems = $.BlobContainersSegment.properties.ContainerItems; - delete $.BlobContainersSegment.properties.ContainerItems; - const path = $.BlobContainersSegment.properties.BlobContainerItems.items.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItem"); - $.BlobContainersSegment.properties.BlobContainerItems.items.$ref = path; - } -- from: swagger-document - where: $["x-ms-paths"]["/?comp=list"] - transform: > - const def = $.get.responses["200"].schema; - if (def && def["$ref"] && !def["$ref"].endsWith("BlobContainersSegment")) { - const path = def["$ref"].replace(/[#].*$/, "#/definitions/BlobContainersSegment"); - $.get.responses["200"].schema = { "$ref": path }; - } - $.get.operationId = "Service_ListBlobContainersSegment"; -``` - -### Change StorageErrorException to StorageException -``` yaml -directive: -- from: ServicesImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: ContainersImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: BlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: AppendBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: BlockBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -- from: PageBlobsImpl.java - where: $ - transform: > - return $. - replace( - "com.azure.storage.blob.implementation.models.StorageErrorException", - "com.azure.storage.blob.models.BlobStorageException" - ). - replace( - /\@UnexpectedResponseExceptionType\(StorageErrorException\.class\)/g, - "@UnexpectedResponseExceptionType(BlobStorageException.class)" - ); -``` - -### GeoReplication -``` yaml -directive: -- from: swagger-document - where: $.definitions.GeoReplication.properties.Status - transform: > - $["x-ms-enum"].name = "GeoReplicationStatus"; -``` - -### BlobErrorCode -``` yaml -directive: -- from: swagger-document - where: $.definitions.ErrorCode - transform: > - $["x-ms-enum"].name = "BlobErrorCode"; -``` - -### BlobServiceProperties, BlobAnalyticsLogging, BlobMetrics, BlobCorsRule, and BlobRetentionPolicy +### /?restype=service&comp=properties ``` yaml directive: - from: swagger-document @@ -1080,32 +973,15 @@ directive: delete $.StorageServiceProperties; $.BlobServiceProperties.xml = { "name": "StorageServiceProperties" }; } - if (!$.BlobAnalyticsLogging) { - $.BlobAnalyticsLogging = $.Logging; - delete $.Logging; - $.BlobAnalyticsLogging.xml = {"name": "Logging"}; - $.BlobServiceProperties.properties.Logging["$ref"] = "#/definitions/BlobAnalyticsLogging"; - } - if (!$.BlobMetrics) { - $.BlobMetrics = $.Metrics; - delete $.Metrics; - $.BlobMetrics.xml = {"name": "Metrics"}; - $.BlobServiceProperties.properties.HourMetrics["$ref"] = "#/definitions/BlobMetrics"; - $.BlobServiceProperties.properties.MinuteMetrics["$ref"] = "#/definitions/BlobMetrics"; - } - if (!$.BlobCorsRule) { - $.BlobCorsRule = $.CorsRule; - delete $.CorsRule; - $.BlobCorsRule.xml = {"name": "CorsRule"}; - $.BlobServiceProperties.properties.Cors.items["$ref"] = "#/definitions/BlobCorsRule"; - } - if (!$.BlobRetentionPolicy) { - $.BlobRetentionPolicy = $.RetentionPolicy; - delete $.RetentionPolicy; - $.BlobRetentionPolicy.xml = {"name": "RetentionPolicy"}; - $.BlobAnalyticsLogging.properties.RetentionPolicy["$ref"] = "#/definitions/BlobRetentionPolicy"; - $.BlobMetrics.properties.RetentionPolicy["$ref"] = "#/definitions/BlobRetentionPolicy"; - $.BlobServiceProperties.properties.DeleteRetentionPolicy["$ref"] = "#/definitions/BlobRetentionPolicy"; + if (!$.BlobContainerProperties) { + $.BlobContainerProperties = $.ContainerProperties; + delete $.ContainerProperties; + } + if (!$.BlobContainerItem) { + $.BlobContainerItem = $.ContainerItem; + const path = $.BlobContainerItem.properties.Properties.$ref.replace(/[#].*$/, "#/definitions/BlobContainerProperties"); + $.BlobContainerItem.properties.Properties.$ref = path; + delete $.ContainerItem; } - from: swagger-document where: $.parameters @@ -1131,80 +1007,29 @@ directive: } ``` -### BlobServiceStatistics -``` yaml -directive: -- from: swagger-document - where: $.definitions - transform: > - if (!$.BlobServiceStatistics) { - $.BlobServiceStatistics = $.StorageServiceStats; - delete $.StorageServiceStats; - $.BlobServiceStatistics.xml = { "name": "StorageServiceStats" } - $.BlobServiceStatistics.description = "Statistics for the storage service."; - } -- from: swagger-document - where: $["x-ms-paths"]["/?restype=service&comp=stats"].get.responses["200"] - transform: > - if ($.schema && $.schema.$ref && $.schema.$ref.endsWith("StorageServiceStats")) { - const path = $.schema.$ref.replace(/[#].*$/, "#/definitions/BlobServiceStatistics"); - $.schema = { "$ref": path }; - } -``` - -### BlobAccessPolicy and BlobSignedIdentifier +### /?comp=list ``` yaml directive: - from: swagger-document where: $.definitions transform: > - if (!$.BlobSignedIdentifier) { - $.BlobSignedIdentifier = $.SignedIdentifier; - delete $.SignedIdentifier; - $.BlobSignedIdentifier.xml = {"name": "SignedIdentifier"}; - $.SignedIdentifiers.items["$ref"] = "#/definitions/BlobSignedIdentifier"; + if (!$.BlobContainersSegment) { + $.BlobContainersSegment = $.ListContainersSegmentResponse; + delete $.ListContainersSegmentResponse; + $.BlobContainersSegment["x-az-public"] = false; + $.BlobContainersSegment.required.push("NextMarker"); + $.BlobContainersSegment.properties.BlobContainerItems = $.BlobContainersSegment.properties.ContainerItems; + delete $.BlobContainersSegment.properties.ContainerItems; + const path = $.BlobContainersSegment.properties.BlobContainerItems.items.$ref.replace(/[#].*$/, "#/definitions/BlobContainerItem"); + $.BlobContainersSegment.properties.BlobContainerItems.items.$ref = path; } - from: swagger-document - where: $.definitions + where: $["x-ms-paths"]["/?comp=list"] transform: > - if (!$.BlobAccessPolicy) { - $.BlobAccessPolicy = $.AccessPolicy; - delete $.AccessPolicy; - $.BlobAccessPolicy.xml = {"name": "AccessPolicy"}; - $.BlobAccessPolicy.properties.StartsOn = $.BlobAccessPolicy.properties.Start; - $.BlobAccessPolicy.properties.StartsOn.xml = {"name": "Start"}; - delete $.BlobAccessPolicy.properties.Start; - $.BlobAccessPolicy.properties.ExpiresOn = $.BlobAccessPolicy.properties.Expiry; - $.BlobAccessPolicy.properties.ExpiresOn.xml = {"name": "Expiry"}; - delete $.BlobAccessPolicy.properties.Expiry; - $.BlobAccessPolicy.properties.Permissions = $.BlobAccessPolicy.properties.Permission; - $.BlobAccessPolicy.properties.Permissions.xml = {"name": "Permission"}; - delete $.BlobAccessPolicy.properties.Permission; + const def = $.get.responses["200"].schema; + if (def && def["$ref"] && !def["$ref"].endsWith("BlobContainersSegment")) { + const path = def["$ref"].replace(/[#].*$/, "#/definitions/BlobContainersSegment"); + $.get.responses["200"].schema = { "$ref": path }; } - $.BlobSignedIdentifier.properties.AccessPolicy["$ref"] = "#/definitions/BlobAccessPolicy"; -``` - -### BlobServiceProperties Annotation Fix -``` yaml -directive: -- from: BlobServiceProperties.java - where: $ - transform: > - return $.replace('@JsonProperty(value = "Metrics")\n private BlobMetrics hourMetrics;', '@JsonProperty(value = "HourMetrics")\n private BlobMetrics hourMetrics;'). - replace('@JsonProperty(value = "Metrics")\n private BlobMetrics minuteMetrics;', '@JsonProperty(value = "MinuteMetrics")\n private BlobMetrics minuteMetrics;'). - replace('@JsonProperty(value = "RetentionPolicy")\n private BlobRetentionPolicy deleteRetentionPolicy;', '@JsonProperty(value = "DeleteRetentionPolicy")\n private BlobRetentionPolicy deleteRetentionPolicy;'); -``` - -### Rename BlobHttpHeaders to BlobHttpHeader -``` yaml -directive: -- from: swagger-document - where: $.parameters - transform: > - $.BlobCacheControl["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentDisposition["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentEncoding["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentLanguage["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentMD5["x-ms-parameter-grouping"].name = "blob-http-headers"; - $.BlobContentType["x-ms-parameter-grouping"].name = "blob-http-headers"; + $.get.operationId = "Service_ListBlobContainersSegment"; ``` From 716aeb0bc1346f608eaa868a262015b18339cb5e Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 25/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../com/azure/storage/blob/implementation/ServicesImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index a082f1b318a4..3f7e014fafae 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -33,6 +33,10 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + /** * An instance of this class provides access to all the operations defined in * Services. From 943864b7f038c64c1b7a5638c403e61e54ea9f45 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 26/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../com/azure/storage/blob/implementation/ServicesImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 3f7e014fafae..a082f1b318a4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -33,10 +33,6 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - /** * An instance of this class provides access to all the operations defined in * Services. From acec01d3bee777f3bed271cd7e87b45e978b1bda Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 27/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../com/azure/storage/blob/implementation/ServicesImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index a082f1b318a4..3f7e014fafae 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -33,6 +33,10 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + /** * An instance of this class provides access to all the operations defined in * Services. From 7b5f83c640b559c755a9c705db849f667b106f86 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 28/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../com/azure/storage/blob/implementation/ServicesImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 3f7e014fafae..a082f1b318a4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -33,10 +33,6 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - /** * An instance of this class provides access to all the operations defined in * Services. From 12af82faf20da4adf2b8a89f1599ea823c011ae6 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 29/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../com/azure/storage/blob/implementation/ServicesImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index a082f1b318a4..3f7e014fafae 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -33,6 +33,10 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + /** * An instance of this class provides access to all the operations defined in * Services. From 52656e9a0245d56d89a1bcea091c547aaf117df7 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 30/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../com/azure/storage/blob/implementation/ServicesImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index 3f7e014fafae..a082f1b318a4 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -33,10 +33,6 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - /** * An instance of this class provides access to all the operations defined in * Services. From ebf05e8b28b278ad541107df0360c440a0c783f0 Mon Sep 17 00:00:00 2001 From: Alan Zimmer <48699787+alzimmermsft@users.noreply.github.com> Date: Thu, 10 Oct 2019 18:27:45 -0700 Subject: [PATCH 31/31] Updated Swagger Transform README (#5769) * Updated Swagger transform README and updated code correspondingly * Delete codegen file that no longer will be generated * Fix linting issues with codesnippet names --- .../com/azure/storage/blob/implementation/ServicesImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index a082f1b318a4..3f7e014fafae 100644 --- a/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -33,6 +33,10 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + /** * An instance of this class provides access to all the operations defined in * Services.