diff --git a/sdk/billing/mgmt-v2018_03_01_preview/pom.xml b/sdk/billing/mgmt-v2018_03_01_preview/pom.xml
new file mode 100644
index 0000000000000..7d59292d405c4
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/pom.xml
@@ -0,0 +1,135 @@
+
+
+ 4.0.0
+ com.microsoft.azure.billing.v2018_03_01_preview
+
+ com.microsoft.azure
+ azure-arm-parent
+ 1.1.0
+ ../../../pom.management.xml
+
+ azure-mgmt-billing
+ 1.0.0-beta
+ jar
+ Microsoft Azure SDK for Billing Management
+ This package contains Microsoft Billing Management SDK.
+ https://github.com/Azure/azure-sdk-for-java
+
+
+ The MIT License (MIT)
+ http://opensource.org/licenses/MIT
+ repo
+
+
+
+ scm:git:https://github.com/Azure/azure-sdk-for-java
+ scm:git:git@github.com:Azure/azure-sdk-for-java.git
+ HEAD
+
+
+ UTF-8
+
+
+
+
+ microsoft
+ Microsoft
+
+
+
+
+ com.microsoft.azure
+ azure-client-runtime
+
+
+ com.microsoft.azure
+ azure-arm-client-runtime
+
+
+ junit
+ junit
+ test
+
+
+ com.microsoft.azure
+ azure-client-authentication
+ test
+
+
+ com.microsoft.azure
+ azure-mgmt-resources
+ test
+
+
+ com.microsoft.azure
+ azure-arm-client-runtime
+ test-jar
+ test
+
+ 1.6.5
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ true
+ true
+
+
+
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.1
+
+
+ 1.7
+
+
+ com.microsoft.azure.management.apigeneration.LangDefinitionProcessor
+
+
+ true
+ true
+
+ true
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.8
+
+ *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search
+
+
+ /**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ */
+ ]]>
+
+
+
+
+
+
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/BillingPeriod.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/BillingPeriod.java
new file mode 100644
index 0000000000000..1da5980b36121
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/BillingPeriod.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.BillingPeriodInner;
+import com.microsoft.azure.arm.model.Indexable;
+import com.microsoft.azure.arm.model.Refreshable;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.BillingManager;
+import org.joda.time.LocalDate;
+import java.util.List;
+
+/**
+ * Type representing BillingPeriod.
+ */
+public interface BillingPeriod extends HasInner, Indexable, Refreshable, HasManager {
+ /**
+ * @return the billingPeriodEndDate value.
+ */
+ LocalDate billingPeriodEndDate();
+
+ /**
+ * @return the billingPeriodStartDate value.
+ */
+ LocalDate billingPeriodStartDate();
+
+ /**
+ * @return the id value.
+ */
+ String id();
+
+ /**
+ * @return the invoiceIds value.
+ */
+ List invoiceIds();
+
+ /**
+ * @return the name value.
+ */
+ String name();
+
+ /**
+ * @return the type value.
+ */
+ String type();
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/BillingPeriods.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/BillingPeriods.java
new file mode 100644
index 0000000000000..cc3d6d22a754e
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/BillingPeriods.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.billing.v2018_03_01_preview;
+
+import com.microsoft.azure.arm.collection.SupportsListing;
+import rx.Observable;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.BillingPeriodsInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing BillingPeriods.
+ */
+public interface BillingPeriods extends SupportsListing, HasInner {
+ /**
+ * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @param billingPeriodName The name of a BillingPeriod resource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable getAsync(String billingPeriodName);
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/DownloadUrl.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/DownloadUrl.java
new file mode 100644
index 0000000000000..972d562ab9f87
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/DownloadUrl.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview;
+
+import org.joda.time.DateTime;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * A secure URL that can be used to download a PDF invoice until the URL
+ * expires.
+ */
+public class DownloadUrl {
+ /**
+ * The time in UTC at which this download URL will expire.
+ */
+ @JsonProperty(value = "expiryTime", access = JsonProperty.Access.WRITE_ONLY)
+ private DateTime expiryTime;
+
+ /**
+ * The URL to the PDF file.
+ */
+ @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY)
+ private String url;
+
+ /**
+ * Get the time in UTC at which this download URL will expire.
+ *
+ * @return the expiryTime value
+ */
+ public DateTime expiryTime() {
+ return this.expiryTime;
+ }
+
+ /**
+ * Get the URL to the PDF file.
+ *
+ * @return the url value
+ */
+ public String url() {
+ return this.url;
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/EnrollmentAccount.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/EnrollmentAccount.java
new file mode 100644
index 0000000000000..9f764934a792b
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/EnrollmentAccount.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.BillingManager;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.EnrollmentAccountInner;
+
+/**
+ * Type representing EnrollmentAccount.
+ */
+public interface EnrollmentAccount extends HasInner, HasManager {
+ /**
+ * @return the id value.
+ */
+ String id();
+
+ /**
+ * @return the name value.
+ */
+ String name();
+
+ /**
+ * @return the principalName value.
+ */
+ String principalName();
+
+ /**
+ * @return the type value.
+ */
+ String type();
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/EnrollmentAccounts.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/EnrollmentAccounts.java
new file mode 100644
index 0000000000000..e87051a1ddc90
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/EnrollmentAccounts.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview;
+
+import rx.Observable;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.EnrollmentAccountsInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing EnrollmentAccounts.
+ */
+public interface EnrollmentAccounts extends HasInner {
+ /**
+ * Gets a enrollment account by name.
+ *
+ * @param name Enrollment Account name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable getAsync(String name);
+
+ /**
+ * Lists the enrollment accounts the caller has access to.
+ *
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable listAsync();
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/ErrorDetails.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/ErrorDetails.java
new file mode 100644
index 0000000000000..c1e398f427456
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/ErrorDetails.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.billing.v2018_03_01_preview;
+
+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;
+
+ /**
+ * The target of the particular error.
+ */
+ @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY)
+ private String target;
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Get the target of the particular error.
+ *
+ * @return the target value
+ */
+ public String target() {
+ return this.target;
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/ErrorResponse.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/ErrorResponse.java
new file mode 100644
index 0000000000000..c26b82219714b
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/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.billing.v2018_03_01_preview;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Error response indicates that the service is not able to process the
+ * incoming request. The reason is provided in the error message.
+ */
+public class ErrorResponse {
+ /**
+ * The details of the error.
+ */
+ @JsonProperty(value = "error")
+ private ErrorDetails error;
+
+ /**
+ * Get the details of the error.
+ *
+ * @return the error value
+ */
+ public ErrorDetails error() {
+ return this.error;
+ }
+
+ /**
+ * Set the details of the error.
+ *
+ * @param error the error value to set
+ * @return the ErrorResponse object itself.
+ */
+ public ErrorResponse withError(ErrorDetails error) {
+ this.error = error;
+ return this;
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/ErrorResponseException.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/ErrorResponseException.java
new file mode 100644
index 0000000000000..3ad46be246a70
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/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.billing.v2018_03_01_preview;
+
+import com.microsoft.rest.RestException;
+import okhttp3.ResponseBody;
+import retrofit2.Response;
+
+/**
+ * Exception thrown for an invalid response with ErrorResponse information.
+ */
+public class ErrorResponseException extends RestException {
+ /**
+ * Initializes a new instance of the ErrorResponseException class.
+ *
+ * @param message the exception message or the response content if a message is not available
+ * @param response the HTTP response
+ */
+ public ErrorResponseException(final String message, final Response response) {
+ super(message, response);
+ }
+
+ /**
+ * Initializes a new instance of the ErrorResponseException class.
+ *
+ * @param message the exception message or the response content if a message is not available
+ * @param response the HTTP response
+ * @param body the deserialized response body
+ */
+ public ErrorResponseException(final String message, final Response response, final ErrorResponse body) {
+ super(message, response, body);
+ }
+
+ @Override
+ public ErrorResponse body() {
+ return (ErrorResponse) super.body();
+ }
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/Invoice.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/Invoice.java
new file mode 100644
index 0000000000000..3c00e9dd86688
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/Invoice.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.billing.v2018_03_01_preview;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.InvoiceInner;
+import com.microsoft.azure.arm.model.Indexable;
+import com.microsoft.azure.arm.model.Refreshable;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.BillingManager;
+import java.util.List;
+import org.joda.time.LocalDate;
+
+/**
+ * Type representing Invoice.
+ */
+public interface Invoice extends HasInner, Indexable, Refreshable, HasManager {
+ /**
+ * @return the billingPeriodIds value.
+ */
+ List billingPeriodIds();
+
+ /**
+ * @return the downloadUrl value.
+ */
+ DownloadUrl downloadUrl();
+
+ /**
+ * @return the id value.
+ */
+ String id();
+
+ /**
+ * @return the invoicePeriodEndDate value.
+ */
+ LocalDate invoicePeriodEndDate();
+
+ /**
+ * @return the invoicePeriodStartDate value.
+ */
+ LocalDate invoicePeriodStartDate();
+
+ /**
+ * @return the name value.
+ */
+ String name();
+
+ /**
+ * @return the type value.
+ */
+ String type();
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/Invoices.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/Invoices.java
new file mode 100644
index 0000000000000..dd00b91e29b91
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/Invoices.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.billing.v2018_03_01_preview;
+
+import com.microsoft.azure.arm.collection.SupportsListing;
+import rx.Observable;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.InvoicesInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing Invoices.
+ */
+public interface Invoices extends SupportsListing, HasInner {
+ /**
+ * Gets a named invoice resource. When getting a single invoice, the downloadUrl property is expanded automatically. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @param invoiceName The name of an invoice resource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable getAsync(String invoiceName);
+
+ /**
+ * Gets the most recent invoice. When getting a single invoice, the downloadUrl property is expanded automatically. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable getLatestAsync();
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/Operation.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/Operation.java
new file mode 100644
index 0000000000000..b02ffe46c9e78
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/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.billing.v2018_03_01_preview;
+
+import com.microsoft.azure.arm.model.HasInner;
+import com.microsoft.azure.arm.resources.models.HasManager;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.BillingManager;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.OperationInner;
+
+/**
+ * Type representing Operation.
+ */
+public interface Operation extends HasInner, HasManager {
+ /**
+ * @return the display value.
+ */
+ OperationDisplay display();
+
+ /**
+ * @return the name value.
+ */
+ String name();
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/OperationDisplay.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/OperationDisplay.java
new file mode 100644
index 0000000000000..154a6898efaf4
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/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.billing.v2018_03_01_preview;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * The object that represents the operation.
+ */
+public class OperationDisplay {
+ /**
+ * Service provider: Microsoft.Billing.
+ */
+ @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY)
+ private String provider;
+
+ /**
+ * Resource on which the operation is performed: Invoice, 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.Billing.
+ *
+ * @return the provider value
+ */
+ public String provider() {
+ return this.provider;
+ }
+
+ /**
+ * Get resource on which the operation is performed: Invoice, etc.
+ *
+ * @return the resource value
+ */
+ public String resource() {
+ return this.resource;
+ }
+
+ /**
+ * Get operation type: Read, write, delete, etc.
+ *
+ * @return the operation value
+ */
+ public String operation() {
+ return this.operation;
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/Operations.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/Operations.java
new file mode 100644
index 0000000000000..619469132bad3
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/Operations.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview;
+
+import rx.Observable;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.implementation.OperationsInner;
+import com.microsoft.azure.arm.model.HasInner;
+
+/**
+ * Type representing Operations.
+ */
+public interface Operations extends HasInner {
+ /**
+ * Lists all of the available billing REST API operations.
+ *
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable for the request
+ */
+ Observable listAsync();
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingManagementClientImpl.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingManagementClientImpl.java
new file mode 100644
index 0000000000000..88775ce68d250
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingManagementClientImpl.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.billing.v2018_03_01_preview.implementation;
+
+import com.microsoft.azure.AzureClient;
+import com.microsoft.azure.AzureServiceClient;
+import com.microsoft.rest.credentials.ServiceClientCredentials;
+import com.microsoft.rest.RestClient;
+
+/**
+ * Initializes a new instance of the BillingManagementClientImpl class.
+ */
+public class BillingManagementClientImpl extends AzureServiceClient {
+ /** the {@link AzureClient} used for long running operations. */
+ private AzureClient azureClient;
+
+ /**
+ * Gets the {@link AzureClient} used for long running operations.
+ * @return the azure client;
+ */
+ public AzureClient getAzureClient() {
+ return this.azureClient;
+ }
+
+ /** Version of the API to be used with the client request. The current version is 2018-03-01-preview. */
+ private String apiVersion;
+
+ /**
+ * Gets Version of the API to be used with the client request. The current version is 2018-03-01-preview.
+ *
+ * @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 BillingManagementClientImpl 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 BillingManagementClientImpl 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 BillingManagementClientImpl 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 BillingManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) {
+ this.generateClientRequestId = generateClientRequestId;
+ return this;
+ }
+
+ /**
+ * The EnrollmentAccountsInner object to access its operations.
+ */
+ private EnrollmentAccountsInner enrollmentAccounts;
+
+ /**
+ * Gets the EnrollmentAccountsInner object to access its operations.
+ * @return the EnrollmentAccountsInner object.
+ */
+ public EnrollmentAccountsInner enrollmentAccounts() {
+ return this.enrollmentAccounts;
+ }
+
+ /**
+ * The BillingPeriodsInner object to access its operations.
+ */
+ private BillingPeriodsInner billingPeriods;
+
+ /**
+ * Gets the BillingPeriodsInner object to access its operations.
+ * @return the BillingPeriodsInner object.
+ */
+ public BillingPeriodsInner billingPeriods() {
+ return this.billingPeriods;
+ }
+
+ /**
+ * The InvoicesInner object to access its operations.
+ */
+ private InvoicesInner invoices;
+
+ /**
+ * Gets the InvoicesInner object to access its operations.
+ * @return the InvoicesInner object.
+ */
+ public InvoicesInner invoices() {
+ return this.invoices;
+ }
+
+ /**
+ * 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 BillingManagementClient client.
+ *
+ * @param credentials the management credentials for Azure
+ */
+ public BillingManagementClientImpl(ServiceClientCredentials credentials) {
+ this("https://management.azure.com", credentials);
+ }
+
+ /**
+ * Initializes an instance of BillingManagementClient client.
+ *
+ * @param baseUrl the base URL of the host
+ * @param credentials the management credentials for Azure
+ */
+ public BillingManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) {
+ super(baseUrl, credentials);
+ initialize();
+ }
+
+ /**
+ * Initializes an instance of BillingManagementClient client.
+ *
+ * @param restClient the REST client to connect to Azure.
+ */
+ public BillingManagementClientImpl(RestClient restClient) {
+ super(restClient);
+ initialize();
+ }
+
+ protected void initialize() {
+ this.apiVersion = "2018-03-01-preview";
+ this.acceptLanguage = "en-US";
+ this.longRunningOperationRetryTimeout = 30;
+ this.generateClientRequestId = true;
+ this.enrollmentAccounts = new EnrollmentAccountsInner(restClient().retrofit(), this);
+ this.billingPeriods = new BillingPeriodsInner(restClient().retrofit(), this);
+ this.invoices = new InvoicesInner(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(), "BillingManagementClient", "2018-03-01-preview");
+ }
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingManager.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingManager.java
new file mode 100644
index 0000000000000..6625d84565b4a
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingManager.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.billing.v2018_03_01_preview.implementation;
+
+import com.microsoft.azure.AzureEnvironment;
+import com.microsoft.azure.AzureResponseBuilder;
+import com.microsoft.azure.credentials.AzureTokenCredentials;
+import com.microsoft.azure.management.apigeneration.Beta;
+import com.microsoft.azure.management.apigeneration.Beta.SinceVersion;
+import com.microsoft.azure.arm.resources.AzureConfigurable;
+import com.microsoft.azure.serializer.AzureJacksonAdapter;
+import com.microsoft.rest.RestClient;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.EnrollmentAccounts;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.BillingPeriods;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.Invoices;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.Operations;
+import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl;
+import com.microsoft.azure.arm.resources.implementation.ManagerCore;
+
+/**
+ * Entry point to Azure Billing resource management.
+ */
+public final class BillingManager extends ManagerCore {
+ private EnrollmentAccounts enrollmentAccounts;
+ private BillingPeriods billingPeriods;
+ private Invoices invoices;
+ private Operations operations;
+ /**
+ * Get a Configurable instance that can be used to create BillingManager with optional configuration.
+ *
+ * @return the instance allowing configurations
+ */
+ public static Configurable configure() {
+ return new BillingManager.ConfigurableImpl();
+ }
+ /**
+ * Creates an instance of BillingManager that exposes Billing resource management API entry points.
+ *
+ * @param credentials the credentials to use
+ * @param subscriptionId the subscription UUID
+ * @return the BillingManager
+ */
+ public static BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
+ return new BillingManager(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 BillingManager that exposes Billing resource management API entry points.
+ *
+ * @param restClient the RestClient to be used for API calls.
+ * @param subscriptionId the subscription UUID
+ * @return the BillingManager
+ */
+ public static BillingManager authenticate(RestClient restClient, String subscriptionId) {
+ return new BillingManager(restClient, subscriptionId);
+ }
+ /**
+ * The interface allowing configurations to be set.
+ */
+ public interface Configurable extends AzureConfigurable {
+ /**
+ * Creates an instance of BillingManager that exposes Billing management API entry points.
+ *
+ * @param credentials the credentials to use
+ * @param subscriptionId the subscription UUID
+ * @return the interface exposing Billing management API entry points that work across subscriptions
+ */
+ BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId);
+ }
+
+ /**
+ * @return Entry point to manage EnrollmentAccounts.
+ */
+ public EnrollmentAccounts enrollmentAccounts() {
+ if (this.enrollmentAccounts == null) {
+ this.enrollmentAccounts = new EnrollmentAccountsImpl(this);
+ }
+ return this.enrollmentAccounts;
+ }
+
+ /**
+ * @return Entry point to manage BillingPeriods.
+ */
+ public BillingPeriods billingPeriods() {
+ if (this.billingPeriods == null) {
+ this.billingPeriods = new BillingPeriodsImpl(this);
+ }
+ return this.billingPeriods;
+ }
+
+ /**
+ * @return Entry point to manage Invoices.
+ */
+ public Invoices invoices() {
+ if (this.invoices == null) {
+ this.invoices = new InvoicesImpl(this);
+ }
+ return this.invoices;
+ }
+
+ /**
+ * @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 BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId) {
+ return BillingManager.authenticate(buildRestClient(credentials), subscriptionId);
+ }
+ }
+ private BillingManager(RestClient restClient, String subscriptionId) {
+ super(
+ restClient,
+ subscriptionId,
+ new BillingManagementClientImpl(restClient).withSubscriptionId(subscriptionId));
+ }
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodImpl.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodImpl.java
new file mode 100644
index 0000000000000..6e9ad5546314f
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodImpl.java
@@ -0,0 +1,72 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ *
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview.implementation;
+
+import com.microsoft.azure.management.billing.v2018_03_01_preview.BillingPeriod;
+import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl;
+import rx.Observable;
+import org.joda.time.LocalDate;
+import java.util.List;
+
+class BillingPeriodImpl extends IndexableRefreshableWrapperImpl implements BillingPeriod {
+ private String billingPeriodName;
+ private final BillingManager manager;
+
+ BillingPeriodImpl(BillingPeriodInner inner, BillingManager manager) {
+ super(null, inner);
+ this.manager = manager;
+ // set resource ancestor and positional variables
+ this.billingPeriodName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingPeriods");
+ }
+
+ @Override
+ public BillingManager manager() {
+ return this.manager;
+ }
+
+ @Override
+ protected Observable getInnerAsync() {
+ BillingPeriodsInner client = this.manager().inner().billingPeriods();
+ return client.getAsync(this.billingPeriodName);
+ }
+
+
+
+ @Override
+ public LocalDate billingPeriodEndDate() {
+ return this.inner().billingPeriodEndDate();
+ }
+
+ @Override
+ public LocalDate billingPeriodStartDate() {
+ return this.inner().billingPeriodStartDate();
+ }
+
+ @Override
+ public String id() {
+ return this.inner().id();
+ }
+
+ @Override
+ public List invoiceIds() {
+ return this.inner().invoiceIds();
+ }
+
+ @Override
+ public String name() {
+ return this.inner().name();
+ }
+
+ @Override
+ public String type() {
+ return this.inner().type();
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodInner.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodInner.java
new file mode 100644
index 0000000000000..eaabc25d225aa
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodInner.java
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview.implementation;
+
+import org.joda.time.LocalDate;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.microsoft.rest.serializer.JsonFlatten;
+import com.microsoft.azure.ProxyResource;
+
+/**
+ * A billing period resource.
+ */
+@JsonFlatten
+public class BillingPeriodInner extends ProxyResource {
+ /**
+ * The start of the date range covered by the billing period.
+ */
+ @JsonProperty(value = "properties.billingPeriodStartDate", access = JsonProperty.Access.WRITE_ONLY)
+ private LocalDate billingPeriodStartDate;
+
+ /**
+ * The end of the date range covered by the billing period.
+ */
+ @JsonProperty(value = "properties.billingPeriodEndDate", access = JsonProperty.Access.WRITE_ONLY)
+ private LocalDate billingPeriodEndDate;
+
+ /**
+ * Array of invoice ids that associated with.
+ */
+ @JsonProperty(value = "properties.invoiceIds", access = JsonProperty.Access.WRITE_ONLY)
+ private List invoiceIds;
+
+ /**
+ * Get the start of the date range covered by the billing period.
+ *
+ * @return the billingPeriodStartDate value
+ */
+ public LocalDate billingPeriodStartDate() {
+ return this.billingPeriodStartDate;
+ }
+
+ /**
+ * Get the end of the date range covered by the billing period.
+ *
+ * @return the billingPeriodEndDate value
+ */
+ public LocalDate billingPeriodEndDate() {
+ return this.billingPeriodEndDate;
+ }
+
+ /**
+ * Get array of invoice ids that associated with.
+ *
+ * @return the invoiceIds value
+ */
+ public List invoiceIds() {
+ return this.invoiceIds;
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodsImpl.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodsImpl.java
new file mode 100644
index 0000000000000..bcc9ccf41c957
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodsImpl.java
@@ -0,0 +1,80 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ * jkl
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview.implementation;
+
+import com.microsoft.azure.arm.model.implementation.WrapperImpl;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.BillingPeriods;
+import rx.Observable;
+import rx.functions.Func1;
+import com.microsoft.azure.PagedList;
+import com.microsoft.azure.Page;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.BillingPeriod;
+import com.microsoft.azure.arm.utils.PagedListConverter;
+
+class BillingPeriodsImpl extends WrapperImpl implements BillingPeriods {
+ private PagedListConverter converter;
+ private final BillingManager manager;
+
+ BillingPeriodsImpl(BillingManager manager) {
+ super(manager.inner().billingPeriods());
+ this.manager = manager;
+ this.converter = new PagedListConverter() {
+ @Override
+ public Observable typeConvertAsync(BillingPeriodInner inner) {
+ return Observable.just((BillingPeriod) wrapModel(inner));
+ }
+ };
+ }
+
+ public BillingManager manager() {
+ return this.manager;
+ }
+
+ private BillingPeriodImpl wrapModel(BillingPeriodInner inner) {
+ return new BillingPeriodImpl(inner, manager());
+ }
+
+ @Override
+ public Observable getAsync(String billingPeriodName) {
+ BillingPeriodsInner client = this.inner();
+ return client.getAsync(billingPeriodName)
+ .map(new Func1() {
+ @Override
+ public BillingPeriod call(BillingPeriodInner inner) {
+ return new BillingPeriodImpl(inner, manager());
+ }
+ });
+ }
+
+ @Override
+ public PagedList list() {
+ BillingPeriodsInner client = this.inner();
+ return converter.convert(client.list());
+ }
+
+ @Override
+ public Observable listAsync() {
+ BillingPeriodsInner client = this.inner();
+ return client.listAsync()
+ .flatMapIterable(new Func1, Iterable>() {
+ @Override
+ public Iterable call(Page page) {
+ return page.items();
+ }
+ })
+ .map(new Func1() {
+ @Override
+ public BillingPeriod call(BillingPeriodInner inner) {
+ return wrapModel(inner);
+ }
+ });
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodsInner.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodsInner.java
new file mode 100644
index 0000000000000..421cfcaa748a9
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/BillingPeriodsInner.java
@@ -0,0 +1,489 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview.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.billing.v2018_03_01_preview.ErrorResponseException;
+import com.microsoft.azure.Page;
+import com.microsoft.azure.PagedList;
+import com.microsoft.rest.ServiceCallback;
+import com.microsoft.rest.ServiceFuture;
+import com.microsoft.rest.ServiceResponse;
+import java.io.IOException;
+import java.util.List;
+import okhttp3.ResponseBody;
+import retrofit2.http.GET;
+import retrofit2.http.Header;
+import retrofit2.http.Headers;
+import retrofit2.http.Path;
+import retrofit2.http.Query;
+import retrofit2.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 BillingPeriods.
+ */
+public class BillingPeriodsInner {
+ /** The Retrofit service to perform REST calls. */
+ private BillingPeriodsService service;
+ /** The service client containing this operation class. */
+ private BillingManagementClientImpl client;
+
+ /**
+ * Initializes an instance of BillingPeriodsInner.
+ *
+ * @param retrofit the Retrofit instance built from a Retrofit Builder.
+ * @param client the instance of the service client containing this operation class.
+ */
+ public BillingPeriodsInner(Retrofit retrofit, BillingManagementClientImpl client) {
+ this.service = retrofit.create(BillingPeriodsService.class);
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for BillingPeriods to be
+ * used by Retrofit to perform actually REST calls.
+ */
+ interface BillingPeriodsService {
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_03_01_preview.BillingPeriods list" })
+ @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods")
+ Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @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.billing.v2018_03_01_preview.BillingPeriods get" })
+ @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}")
+ Observable> get(@Path("subscriptionId") String subscriptionId, @Path("billingPeriodName") String billingPeriodName, @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.billing.v2018_03_01_preview.BillingPeriods listNext" })
+ @GET
+ Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
+ }
+
+ /**
+ * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @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<BillingPeriodInner> object if successful.
+ */
+ public PagedList list() {
+ ServiceResponse> response = listSinglePageAsync().toBlocking().single();
+ return new PagedList(response.body()) {
+ @Override
+ public Page nextPage(String nextPageLink) {
+ return listNextSinglePageAsync(nextPageLink).toBlocking().single().body();
+ }
+ };
+ }
+
+ /**
+ * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the {@link ServiceFuture} object
+ */
+ public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) {
+ return AzureServiceFuture.fromPageResponse(
+ listSinglePageAsync(),
+ new Func1>>>() {
+ @Override
+ public Observable>> call(String nextPageLink) {
+ return listNextSinglePageAsync(nextPageLink);
+ }
+ },
+ serviceCallback);
+ }
+
+ /**
+ * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the PagedList<BillingPeriodInner> object
+ */
+ public Observable> listAsync() {
+ return listWithServiceResponseAsync()
+ .map(new Func1>, Page>() {
+ @Override
+ public Page call(ServiceResponse> response) {
+ return response.body();
+ }
+ });
+ }
+
+ /**
+ * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the PagedList<BillingPeriodInner> object
+ */
+ public Observable>> listWithServiceResponseAsync() {
+ return listSinglePageAsync()
+ .concatMap(new Func1>, Observable>>>() {
+ @Override
+ public Observable>> call(ServiceResponse> page) {
+ String nextPageLink = page.body().nextPageLink();
+ if (nextPageLink == null) {
+ return Observable.just(page);
+ }
+ return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink));
+ }
+ });
+ }
+
+ /**
+ * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the PagedList<BillingPeriodInner> object wrapped in {@link ServiceResponse} if successful.
+ */
+ public Observable>> listSinglePageAsync() {
+ if (this.client.subscriptionId() == null) {
+ throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
+ }
+ if (this.client.apiVersion() == null) {
+ throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
+ }
+ final String filter = null;
+ final String skiptoken = null;
+ final Integer top = null;
+ return service.list(this.client.subscriptionId(), this.client.apiVersion(), filter, skiptoken, top, 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 available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @param filter May be used to filter billing periods by billingPeriodEndDate. 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 billing periods.
+ * @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<BillingPeriodInner> object if successful.
+ */
+ public PagedList list(final String filter, final String skiptoken, final Integer top) {
+ ServiceResponse> response = listSinglePageAsync(filter, skiptoken, top).toBlocking().single();
+ return new PagedList(response.body()) {
+ @Override
+ public Page nextPage(String nextPageLink) {
+ return listNextSinglePageAsync(nextPageLink).toBlocking().single().body();
+ }
+ };
+ }
+
+ /**
+ * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @param filter May be used to filter billing periods by billingPeriodEndDate. 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 billing periods.
+ * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the {@link ServiceFuture} object
+ */
+ public ServiceFuture> listAsync(final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) {
+ return AzureServiceFuture.fromPageResponse(
+ listSinglePageAsync(filter, skiptoken, top),
+ new Func1>>>() {
+ @Override
+ public Observable>> call(String nextPageLink) {
+ return listNextSinglePageAsync(nextPageLink);
+ }
+ },
+ serviceCallback);
+ }
+
+ /**
+ * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @param filter May be used to filter billing periods by billingPeriodEndDate. 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 billing periods.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the PagedList<BillingPeriodInner> object
+ */
+ public Observable> listAsync(final String filter, final String skiptoken, final Integer top) {
+ return listWithServiceResponseAsync(filter, skiptoken, top)
+ .map(new Func1>, Page>() {
+ @Override
+ public Page call(ServiceResponse> response) {
+ return response.body();
+ }
+ });
+ }
+
+ /**
+ * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @param filter May be used to filter billing periods by billingPeriodEndDate. 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 billing periods.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the PagedList<BillingPeriodInner> object
+ */
+ public Observable>> listWithServiceResponseAsync(final String filter, final String skiptoken, final Integer top) {
+ return listSinglePageAsync(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 available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ ServiceResponse> * @param filter May be used to filter billing periods by billingPeriodEndDate. 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 billing periods.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the PagedList<BillingPeriodInner> object wrapped in {@link ServiceResponse} if successful.
+ */
+ public Observable>> listSinglePageAsync(final String filter, final String skiptoken, final Integer top) {
+ if (this.client.subscriptionId() == null) {
+ throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
+ }
+ if (this.client.apiVersion() == null) {
+ throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
+ }
+ return service.list(this.client.subscriptionId(), this.client.apiVersion(), filter, skiptoken, top, 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);
+ }
+
+ /**
+ * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @param billingPeriodName The name of a BillingPeriod resource.
+ * @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 BillingPeriodInner object if successful.
+ */
+ public BillingPeriodInner get(String billingPeriodName) {
+ return getWithServiceResponseAsync(billingPeriodName).toBlocking().single().body();
+ }
+
+ /**
+ * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @param billingPeriodName The name of a BillingPeriod resource.
+ * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the {@link ServiceFuture} object
+ */
+ public ServiceFuture getAsync(String billingPeriodName, final ServiceCallback serviceCallback) {
+ return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingPeriodName), serviceCallback);
+ }
+
+ /**
+ * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @param billingPeriodName The name of a BillingPeriod resource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the BillingPeriodInner object
+ */
+ public Observable getAsync(String billingPeriodName) {
+ return getWithServiceResponseAsync(billingPeriodName).map(new Func1, BillingPeriodInner>() {
+ @Override
+ public BillingPeriodInner call(ServiceResponse response) {
+ return response.body();
+ }
+ });
+ }
+
+ /**
+ * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @param billingPeriodName The name of a BillingPeriod resource.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the BillingPeriodInner object
+ */
+ public Observable> getWithServiceResponseAsync(String billingPeriodName) {
+ if (this.client.subscriptionId() == null) {
+ throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
+ }
+ if (billingPeriodName == null) {
+ throw new IllegalArgumentException("Parameter billingPeriodName is required and cannot be null.");
+ }
+ if (this.client.apiVersion() == null) {
+ throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
+ }
+ return service.get(this.client.subscriptionId(), billingPeriodName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
+ .flatMap(new Func1, Observable>>() {
+ @Override
+ public Observable> call(Response response) {
+ try {
+ ServiceResponse clientResponse = getDelegate(response);
+ return Observable.just(clientResponse);
+ } catch (Throwable t) {
+ return Observable.error(t);
+ }
+ }
+ });
+ }
+
+ private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException {
+ return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
+ .register(200, new TypeToken() { }.getType())
+ .registerError(ErrorResponseException.class)
+ .build(response);
+ }
+
+ /**
+ * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @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<BillingPeriodInner> 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 available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @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 available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @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<BillingPeriodInner> 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 available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ * @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<BillingPeriodInner> 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 available billing periods for a subscription in reverse chronological order. This is only supported for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API.
+ *
+ ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the PagedList<BillingPeriodInner> object wrapped in {@link ServiceResponse} if successful.
+ */
+ public Observable>> listNextSinglePageAsync(final String nextPageLink) {
+ if (nextPageLink == null) {
+ throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
+ }
+ String nextUrl = String.format("%s", nextPageLink);
+ return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
+ .flatMap(new Func1, Observable>>>() {
+ @Override
+ public Observable>> call(Response response) {
+ try {
+ ServiceResponse> result = listNextDelegate(response);
+ return Observable.just(new ServiceResponse>(result.body(), result.response()));
+ } catch (Throwable t) {
+ return Observable.error(t);
+ }
+ }
+ });
+ }
+
+ private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException {
+ return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter())
+ .register(200, new TypeToken>() { }.getType())
+ .registerError(ErrorResponseException.class)
+ .build(response);
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountImpl.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountImpl.java
new file mode 100644
index 0000000000000..0a6c15b42680c
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountImpl.java
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview.implementation;
+
+import com.microsoft.azure.management.billing.v2018_03_01_preview.EnrollmentAccount;
+import com.microsoft.azure.arm.model.implementation.WrapperImpl;
+
+class EnrollmentAccountImpl extends WrapperImpl implements EnrollmentAccount {
+ private final BillingManager manager;
+ EnrollmentAccountImpl(EnrollmentAccountInner inner, BillingManager manager) {
+ super(inner);
+ this.manager = manager;
+ }
+
+ @Override
+ public BillingManager manager() {
+ return this.manager;
+ }
+
+ @Override
+ public String id() {
+ return this.inner().id();
+ }
+
+ @Override
+ public String name() {
+ return this.inner().name();
+ }
+
+ @Override
+ public String principalName() {
+ return this.inner().principalName();
+ }
+
+ @Override
+ public String type() {
+ return this.inner().type();
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountInner.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountInner.java
new file mode 100644
index 0000000000000..957d11f7dd6c5
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountInner.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview.implementation;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.microsoft.rest.serializer.JsonFlatten;
+import com.microsoft.azure.ProxyResource;
+
+/**
+ * An enrollment account resource.
+ */
+@JsonFlatten
+public class EnrollmentAccountInner extends ProxyResource {
+ /**
+ * The account owner's principal name.
+ */
+ @JsonProperty(value = "properties.principalName", access = JsonProperty.Access.WRITE_ONLY)
+ private String principalName;
+
+ /**
+ * Get the account owner's principal name.
+ *
+ * @return the principalName value
+ */
+ public String principalName() {
+ return this.principalName;
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountsImpl.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountsImpl.java
new file mode 100644
index 0000000000000..d501cf13a6996
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountsImpl.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights 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.billing.v2018_03_01_preview.implementation;
+
+import com.microsoft.azure.arm.model.implementation.WrapperImpl;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.EnrollmentAccounts;
+import rx.functions.Func1;
+import rx.Observable;
+import com.microsoft.azure.Page;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.EnrollmentAccount;
+
+class EnrollmentAccountsImpl extends WrapperImpl implements EnrollmentAccounts {
+ private final BillingManager manager;
+
+ EnrollmentAccountsImpl(BillingManager manager) {
+ super(manager.inner().enrollmentAccounts());
+ this.manager = manager;
+ }
+
+ public BillingManager manager() {
+ return this.manager;
+ }
+
+ @Override
+ public Observable getAsync(String name) {
+ EnrollmentAccountsInner client = this.inner();
+ return client.getAsync(name)
+ .map(new Func1() {
+ @Override
+ public EnrollmentAccount call(EnrollmentAccountInner inner) {
+ return new EnrollmentAccountImpl(inner, manager());
+ }
+ });
+ }
+
+ @Override
+ public Observable listAsync() {
+ EnrollmentAccountsInner client = this.inner();
+ return client.listAsync()
+ .flatMapIterable(new Func1, Iterable>() {
+ @Override
+ public Iterable call(Page page) {
+ return page.items();
+ }
+ })
+ .map(new Func1() {
+ @Override
+ public EnrollmentAccount call(EnrollmentAccountInner inner) {
+ return new EnrollmentAccountImpl(inner, manager());
+ }
+ });
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountsInner.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountsInner.java
new file mode 100644
index 0000000000000..9041f915af3c7
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/EnrollmentAccountsInner.java
@@ -0,0 +1,365 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview.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.billing.v2018_03_01_preview.ErrorResponseException;
+import com.microsoft.azure.Page;
+import com.microsoft.azure.PagedList;
+import com.microsoft.rest.ServiceCallback;
+import com.microsoft.rest.ServiceFuture;
+import com.microsoft.rest.ServiceResponse;
+import java.io.IOException;
+import java.util.List;
+import okhttp3.ResponseBody;
+import retrofit2.http.GET;
+import retrofit2.http.Header;
+import retrofit2.http.Headers;
+import retrofit2.http.Path;
+import retrofit2.http.Query;
+import retrofit2.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 EnrollmentAccounts.
+ */
+public class EnrollmentAccountsInner {
+ /** The Retrofit service to perform REST calls. */
+ private EnrollmentAccountsService service;
+ /** The service client containing this operation class. */
+ private BillingManagementClientImpl client;
+
+ /**
+ * Initializes an instance of EnrollmentAccountsInner.
+ *
+ * @param retrofit the Retrofit instance built from a Retrofit Builder.
+ * @param client the instance of the service client containing this operation class.
+ */
+ public EnrollmentAccountsInner(Retrofit retrofit, BillingManagementClientImpl client) {
+ this.service = retrofit.create(EnrollmentAccountsService.class);
+ this.client = client;
+ }
+
+ /**
+ * The interface defining all the services for EnrollmentAccounts to be
+ * used by Retrofit to perform actually REST calls.
+ */
+ interface EnrollmentAccountsService {
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_03_01_preview.EnrollmentAccounts list" })
+ @GET("providers/Microsoft.Billing/enrollmentAccounts")
+ 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.billing.v2018_03_01_preview.EnrollmentAccounts get" })
+ @GET("providers/Microsoft.Billing/enrollmentAccounts/{name}")
+ Observable> get(@Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
+ @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_03_01_preview.EnrollmentAccounts listNext" })
+ @GET
+ Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
+
+ }
+
+ /**
+ * Lists the enrollment accounts the caller has access to.
+ *
+ * @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<EnrollmentAccountInner> object if successful.
+ */
+ public PagedList list() {
+ ServiceResponse> response = listSinglePageAsync().toBlocking().single();
+ return new PagedList(response.body()) {
+ @Override
+ public Page nextPage(String nextPageLink) {
+ return listNextSinglePageAsync(nextPageLink).toBlocking().single().body();
+ }
+ };
+ }
+
+ /**
+ * Lists the enrollment accounts the caller has access to.
+ *
+ * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the {@link ServiceFuture} object
+ */
+ public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) {
+ return AzureServiceFuture.fromPageResponse(
+ listSinglePageAsync(),
+ new Func1>>>() {
+ @Override
+ public Observable>> call(String nextPageLink) {
+ return listNextSinglePageAsync(nextPageLink);
+ }
+ },
+ serviceCallback);
+ }
+
+ /**
+ * Lists the enrollment accounts the caller has access to.
+ *
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the PagedList<EnrollmentAccountInner> object
+ */
+ public Observable> listAsync() {
+ return listWithServiceResponseAsync()
+ .map(new Func1>, Page>() {
+ @Override
+ public Page call(ServiceResponse> response) {
+ return response.body();
+ }
+ });
+ }
+
+ /**
+ * Lists the enrollment accounts the caller has access to.
+ *
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the PagedList<EnrollmentAccountInner> object
+ */
+ public Observable>> listWithServiceResponseAsync() {
+ return listSinglePageAsync()
+ .concatMap(new Func1>, Observable>>>() {
+ @Override
+ public Observable>> call(ServiceResponse> page) {
+ String nextPageLink = page.body().nextPageLink();
+ if (nextPageLink == null) {
+ return Observable.just(page);
+ }
+ return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink));
+ }
+ });
+ }
+
+ /**
+ * Lists the enrollment accounts the caller has access to.
+ *
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the PagedList<EnrollmentAccountInner> 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);
+ }
+
+ /**
+ * Gets a enrollment account by name.
+ *
+ * @param name Enrollment Account name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @throws ErrorResponseException thrown if the request is rejected by server
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
+ * @return the EnrollmentAccountInner object if successful.
+ */
+ public EnrollmentAccountInner get(String name) {
+ return getWithServiceResponseAsync(name).toBlocking().single().body();
+ }
+
+ /**
+ * Gets a enrollment account by name.
+ *
+ * @param name Enrollment Account name.
+ * @param serviceCallback the async ServiceCallback to handle successful and failed responses.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the {@link ServiceFuture} object
+ */
+ public ServiceFuture getAsync(String name, final ServiceCallback serviceCallback) {
+ return ServiceFuture.fromResponse(getWithServiceResponseAsync(name), serviceCallback);
+ }
+
+ /**
+ * Gets a enrollment account by name.
+ *
+ * @param name Enrollment Account name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the EnrollmentAccountInner object
+ */
+ public Observable getAsync(String name) {
+ return getWithServiceResponseAsync(name).map(new Func1, EnrollmentAccountInner>() {
+ @Override
+ public EnrollmentAccountInner call(ServiceResponse response) {
+ return response.body();
+ }
+ });
+ }
+
+ /**
+ * Gets a enrollment account by name.
+ *
+ * @param name Enrollment Account name.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the observable to the EnrollmentAccountInner object
+ */
+ public Observable> getWithServiceResponseAsync(String name) {
+ if (name == null) {
+ throw new IllegalArgumentException("Parameter name is required and cannot be null.");
+ }
+ if (this.client.apiVersion() == null) {
+ throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
+ }
+ return service.get(name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
+ .flatMap(new Func1, Observable>>() {
+ @Override
+ public Observable> call(Response response) {
+ try {
+ ServiceResponse clientResponse = getDelegate(response);
+ return Observable.just(clientResponse);
+ } catch (Throwable t) {
+ return Observable.error(t);
+ }
+ }
+ });
+ }
+
+ private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException {
+ return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
+ .register(200, new TypeToken() { }.getType())
+ .registerError(ErrorResponseException.class)
+ .build(response);
+ }
+
+ /**
+ * Lists the enrollment accounts the caller has access to.
+ *
+ * @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<EnrollmentAccountInner> 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 enrollment accounts the caller has access to.
+ *
+ * @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 enrollment accounts the caller has access to.
+ *
+ * @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<EnrollmentAccountInner> 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 enrollment accounts the caller has access to.
+ *
+ * @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<EnrollmentAccountInner> 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 enrollment accounts the caller has access to.
+ *
+ ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation
+ * @return the PagedList<EnrollmentAccountInner> object wrapped in {@link ServiceResponse} if successful.
+ */
+ public Observable>> listNextSinglePageAsync(final String nextPageLink) {
+ if (nextPageLink == null) {
+ throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
+ }
+ String nextUrl = String.format("%s", nextPageLink);
+ return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
+ .flatMap(new Func1, Observable>>>() {
+ @Override
+ public Observable>> call(Response response) {
+ try {
+ ServiceResponse> result = listNextDelegate(response);
+ return Observable.just(new ServiceResponse>(result.body(), result.response()));
+ } catch (Throwable t) {
+ return Observable.error(t);
+ }
+ }
+ });
+ }
+
+ private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException {
+ return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter())
+ .register(200, new TypeToken>() { }.getType())
+ .registerError(ErrorResponseException.class)
+ .build(response);
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/IdParsingUtils.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/IdParsingUtils.java
new file mode 100644
index 0000000000000..3286a657a8edf
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/IdParsingUtils.java
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview.implementation;
+import java.util.Arrays;
+import java.util.Iterator;
+
+class IdParsingUtils {
+ public static String getValueFromIdByName(String id, String name) {
+ if (id == null) {
+ return null;
+ }
+ Iterable iterable = Arrays.asList(id.split("/"));
+ Iterator itr = iterable.iterator();
+ while (itr.hasNext()) {
+ String part = itr.next();
+ if (part != null && part.trim() != "") {
+ if (part.equalsIgnoreCase(name)) {
+ if (itr.hasNext()) {
+ return itr.next();
+ } else {
+ return null;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public static String getValueFromIdByPosition(String id, int pos) {
+ if (id == null) {
+ return null;
+ }
+ Iterable iterable = Arrays.asList(id.split("/"));
+ Iterator itr = iterable.iterator();
+ int index = 0;
+ while (itr.hasNext()) {
+ String part = itr.next();
+ if (part != null && part.trim() != "") {
+ if (index == pos) {
+ if (itr.hasNext()) {
+ return itr.next();
+ } else {
+ return null;
+ }
+ }
+ }
+ index++;
+ }
+ return null;
+ }
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/InvoiceImpl.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/InvoiceImpl.java
new file mode 100644
index 0000000000000..8cbc6d5328e67
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/InvoiceImpl.java
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ *
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview.implementation;
+
+import com.microsoft.azure.management.billing.v2018_03_01_preview.Invoice;
+import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl;
+import rx.Observable;
+import java.util.List;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.DownloadUrl;
+import org.joda.time.LocalDate;
+
+class InvoiceImpl extends IndexableRefreshableWrapperImpl implements Invoice {
+ private String invoiceName;
+ private final BillingManager manager;
+
+ InvoiceImpl(InvoiceInner inner, BillingManager manager) {
+ super(null, inner);
+ this.manager = manager;
+ // set resource ancestor and positional variables
+ this.invoiceName = IdParsingUtils.getValueFromIdByName(inner.id(), "invoices");
+ }
+
+ @Override
+ public BillingManager manager() {
+ return this.manager;
+ }
+
+ @Override
+ protected Observable getInnerAsync() {
+ InvoicesInner client = this.manager().inner().invoices();
+ return client.getAsync(this.invoiceName);
+ }
+
+
+
+ @Override
+ public List billingPeriodIds() {
+ return this.inner().billingPeriodIds();
+ }
+
+ @Override
+ public DownloadUrl downloadUrl() {
+ return this.inner().downloadUrl();
+ }
+
+ @Override
+ public String id() {
+ return this.inner().id();
+ }
+
+ @Override
+ public LocalDate invoicePeriodEndDate() {
+ return this.inner().invoicePeriodEndDate();
+ }
+
+ @Override
+ public LocalDate invoicePeriodStartDate() {
+ return this.inner().invoicePeriodStartDate();
+ }
+
+ @Override
+ public String name() {
+ return this.inner().name();
+ }
+
+ @Override
+ public String type() {
+ return this.inner().type();
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/InvoiceInner.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/InvoiceInner.java
new file mode 100644
index 0000000000000..9a60d1123e623
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/InvoiceInner.java
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview.implementation;
+
+import com.microsoft.azure.management.billing.v2018_03_01_preview.DownloadUrl;
+import org.joda.time.LocalDate;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.microsoft.rest.serializer.JsonFlatten;
+import com.microsoft.azure.ProxyResource;
+
+/**
+ * An invoice resource can be used download a PDF version of an invoice.
+ */
+@JsonFlatten
+public class InvoiceInner extends ProxyResource {
+ /**
+ * A secure link to download the PDF version of an invoice. The link will
+ * cease to work after its expiry time is reached.
+ */
+ @JsonProperty(value = "properties.downloadUrl")
+ private DownloadUrl downloadUrl;
+
+ /**
+ * The start of the date range covered by the invoice.
+ */
+ @JsonProperty(value = "properties.invoicePeriodStartDate", access = JsonProperty.Access.WRITE_ONLY)
+ private LocalDate invoicePeriodStartDate;
+
+ /**
+ * The end of the date range covered by the invoice.
+ */
+ @JsonProperty(value = "properties.invoicePeriodEndDate", access = JsonProperty.Access.WRITE_ONLY)
+ private LocalDate invoicePeriodEndDate;
+
+ /**
+ * Array of billing period ids that the invoice is attributed to.
+ */
+ @JsonProperty(value = "properties.billingPeriodIds", access = JsonProperty.Access.WRITE_ONLY)
+ private List billingPeriodIds;
+
+ /**
+ * Get a secure link to download the PDF version of an invoice. The link will cease to work after its expiry time is reached.
+ *
+ * @return the downloadUrl value
+ */
+ public DownloadUrl downloadUrl() {
+ return this.downloadUrl;
+ }
+
+ /**
+ * Set a secure link to download the PDF version of an invoice. The link will cease to work after its expiry time is reached.
+ *
+ * @param downloadUrl the downloadUrl value to set
+ * @return the InvoiceInner object itself.
+ */
+ public InvoiceInner withDownloadUrl(DownloadUrl downloadUrl) {
+ this.downloadUrl = downloadUrl;
+ return this;
+ }
+
+ /**
+ * Get the start of the date range covered by the invoice.
+ *
+ * @return the invoicePeriodStartDate value
+ */
+ public LocalDate invoicePeriodStartDate() {
+ return this.invoicePeriodStartDate;
+ }
+
+ /**
+ * Get the end of the date range covered by the invoice.
+ *
+ * @return the invoicePeriodEndDate value
+ */
+ public LocalDate invoicePeriodEndDate() {
+ return this.invoicePeriodEndDate;
+ }
+
+ /**
+ * Get array of billing period ids that the invoice is attributed to.
+ *
+ * @return the billingPeriodIds value
+ */
+ public List billingPeriodIds() {
+ return this.billingPeriodIds;
+ }
+
+}
diff --git a/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/InvoicesImpl.java b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/InvoicesImpl.java
new file mode 100644
index 0000000000000..79840d1f45b55
--- /dev/null
+++ b/sdk/billing/mgmt-v2018_03_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_03_01_preview/implementation/InvoicesImpl.java
@@ -0,0 +1,92 @@
+/**
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for
+ * license information.
+ *
+ * Code generated by Microsoft (R) AutoRest Code Generator.
+ * jkl
+ */
+
+package com.microsoft.azure.management.billing.v2018_03_01_preview.implementation;
+
+import com.microsoft.azure.arm.model.implementation.WrapperImpl;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.Invoices;
+import rx.Observable;
+import rx.functions.Func1;
+import com.microsoft.azure.PagedList;
+import com.microsoft.azure.Page;
+import com.microsoft.azure.management.billing.v2018_03_01_preview.Invoice;
+import com.microsoft.azure.arm.utils.PagedListConverter;
+
+class InvoicesImpl extends WrapperImpl implements Invoices {
+ private PagedListConverter converter;
+ private final BillingManager manager;
+
+ InvoicesImpl(BillingManager manager) {
+ super(manager.inner().invoices());
+ this.manager = manager;
+ this.converter = new PagedListConverter() {
+ @Override
+ public Observable typeConvertAsync(InvoiceInner inner) {
+ return Observable.just((Invoice) wrapModel(inner));
+ }
+ };
+ }
+
+ public BillingManager manager() {
+ return this.manager;
+ }
+
+ private InvoiceImpl wrapModel(InvoiceInner inner) {
+ return new InvoiceImpl(inner, manager());
+ }
+
+ @Override
+ public Observable