diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreements.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreements.java index a3c9fca402c2..0b69e41a84be 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreements.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreements.java @@ -17,22 +17,22 @@ */ public interface Agreements extends HasInner { /** - * Lists all agreements for a billing account. + * Get the agreement by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. + * @param agreementName Agreement Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingAccountNameAsync(String billingAccountName); + Observable getAsync(String billingAccountName, String agreementName); /** - * Get the agreement by name. + * Lists all agreements for a billing account. * - * @param billingAccountName billing Account Id. - * @param agreementName Agreement Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getAsync(String billingAccountName, String agreementName); + Observable listByBillingAccountNameAsync(final String billingAccountName); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalances.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalances.java index 76e7073bc02c..a78f8c438977 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalances.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalances.java @@ -19,7 +19,7 @@ public interface AvailableBalances extends HasInner { /** * The latest available credit balance for a given billingAccountName and billingProfileName. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccounts.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccounts.java index 4c2e8a2b20b7..a9d73991f488 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccounts.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccounts.java @@ -19,18 +19,18 @@ public interface BillingAccounts extends HasInner { /** * Get the billing account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ Observable getAsync(String billingAccountName); /** - * Lists all billing accounts for a user which he has access to. + * Lists all billing accounts for which a user has access. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listAsync(); + Observable listAsync(); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissions.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissions.java index be407544e670..50aff2e494d6 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissions.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissions.java @@ -19,16 +19,26 @@ public interface BillingPermissions extends HasInner { /** * Lists all billing permissions for the caller under a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ Observable listByBillingAccountAsync(String billingAccountName); + /** + * Lists all billing permissions for the caller under customer. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomersAsync(String billingAccountName, String customerName); + /** * Lists all billing permissions for the caller under invoice section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -38,7 +48,7 @@ public interface BillingPermissions extends HasInner { /** * Lists all billingPermissions for the caller has for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfiles.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfiles.java index fec826d22397..a7b1876c09db 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfiles.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfiles.java @@ -17,28 +17,28 @@ */ public interface BillingProfiles extends HasInner { /** - * Lists all billing profiles for a user which that user has access to. + * Get the billing profile by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingAccountNameAsync(String billingAccountName); + Observable getAsync(String billingAccountName, String billingProfileName); /** - * Get the billing profile by id. + * Lists all billing profiles for a user which that user has access to. * - * @param billingAccountName billing Account Id. - * @param billingProfileName Billing Profile Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getAsync(String billingAccountName, String billingProfileName); + Observable listByBillingAccountNameAsync(final String billingAccountName); /** * The operation to create a BillingProfile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the Create BillingProfile operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignments.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignments.java index 2121897f806e..427173903e80 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignments.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignments.java @@ -18,7 +18,7 @@ public interface BillingRoleAssignments { /** * Get the role assignment for the caller. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -28,7 +28,7 @@ public interface BillingRoleAssignments { /** * Delete the role assignment on this billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -38,7 +38,7 @@ public interface BillingRoleAssignments { /** * Get the role assignment for the caller on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -49,7 +49,7 @@ public interface BillingRoleAssignments { /** * Delete the role assignment on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -60,7 +60,7 @@ public interface BillingRoleAssignments { /** * Get the role assignment for the caller on the Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -71,7 +71,7 @@ public interface BillingRoleAssignments { /** * Delete the role assignment on this Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -82,7 +82,7 @@ public interface BillingRoleAssignments { /** * Get the role assignments on the Billing Account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ @@ -91,7 +91,7 @@ public interface BillingRoleAssignments { /** * Get the role assignments on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -101,7 +101,7 @@ public interface BillingRoleAssignments { /** * Get the role assignments on the Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -111,7 +111,7 @@ public interface BillingRoleAssignments { /** * The operation to add a role assignment to a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to add a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -121,7 +121,7 @@ public interface BillingRoleAssignments { /** * The operation to add a role assignment to a invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param parameters Parameters supplied to add a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -132,7 +132,7 @@ public interface BillingRoleAssignments { /** * The operation to add a role assignment to a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param parameters Parameters supplied to add a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitions.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitions.java index d0154c11f319..39e7c6207cd3 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitions.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitions.java @@ -19,7 +19,7 @@ public interface BillingRoleDefinitions extends HasInner listByBillingProfileNameAsync(String billingAccountName, String billingProfileName); + Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName); + + /** + * Lists billing subscription by customer name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomerNameAsync(final String billingAccountName, final String customerName); + + /** + * Get a single billing subscription by name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param billingSubscriptionName Billing Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByCustomerNameAsync(String billingAccountName, String customerName, String billingSubscriptionName); /** * Lists billing subscription by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName); + Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName); /** * Get a single billing subscription by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingSubscriptionName Billing Subscription Id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -50,7 +71,7 @@ public interface BillingSubscriptions extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enabledAzureSKUs value. + */ + List enabledAzureSKUs(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resellers value. + */ + List resellers(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/CustomerListResult.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/CustomerListResult.java new file mode 100644 index 000000000000..d208ad106602 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/CustomerListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.CustomerListResultInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.CustomerInner; +import java.util.List; + +/** + * Type representing CustomerListResult. + */ +public interface CustomerListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Customers.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Customers.java new file mode 100644 index 000000000000..b098a5412c3c --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Customers.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.CustomersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Customers. + */ +public interface Customers extends HasInner { + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String customerName); + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName); + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Departments.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Departments.java index 5abbd9c3d1ec..35214e5bdfab 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Departments.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Departments.java @@ -17,22 +17,22 @@ */ public interface Departments extends HasInner { /** - * Lists all departments for a user which he has access to. + * Get the department by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. + * @param departmentName Department Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingAccountNameAsync(String billingAccountName); + Observable getAsync(String billingAccountName, String departmentName); /** - * Get the department by id. + * Lists all departments for which a user has access. * - * @param billingAccountName billing Account Id. - * @param departmentName Department Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getAsync(String billingAccountName, String departmentName); + Observable listByBillingAccountNameAsync(final String billingAccountName); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccounts.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccounts.java index 6521384f1f0f..a8a730512d38 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccounts.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccounts.java @@ -17,22 +17,22 @@ */ public interface EnrollmentAccounts extends HasInner { /** - * Lists all Enrollment Accounts for a user which he has access to. + * Get the enrollment account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. + * @param enrollmentAccountName Enrollment Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingAccountNameAsync(String billingAccountName); + Observable getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName); /** - * Get the enrollment account by id. + * Lists all Enrollment Accounts for which a user has access. * - * @param billingAccountName billing Account Id. - * @param enrollmentAccountName Enrollment Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName); + Observable listByBillingAccountNameAsync(final String billingAccountName); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSections.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSections.java index 98d62cf7bb1d..c04db388cd76 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSections.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSections.java @@ -18,28 +18,28 @@ */ public interface InvoiceSections extends HasInner { /** - * Lists all invoice sections for a user which he has access to. + * Lists all invoice sections for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ Observable listByBillingAccountNameAsync(String billingAccountName); /** - * Lists all invoice sections under a billing profile for a user which he has access to. + * Lists all invoice sections under a billing profile for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName); + Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName); /** * Elevates the caller's access to match their billing profile access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -49,7 +49,7 @@ public interface InvoiceSections extends HasInner { /** * Get the InvoiceSection by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -59,7 +59,7 @@ public interface InvoiceSections extends HasInner { /** * The operation to create a InvoiceSection. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the Create InvoiceSection operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -69,10 +69,10 @@ public interface InvoiceSections extends HasInner { /** * Lists all invoiceSections with create subscription permission for a user. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByCreateSubscriptionPermissionAsync(String billingAccountName); + Observable listByCreateSubscriptionPermissionAsync(final String billingAccountName); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSummary.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSummary.java index efbfb24a5fb8..22e815041d8d 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSummary.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSummary.java @@ -9,9 +9,9 @@ package com.microsoft.azure.management.billing.v2018_11_01_preview; import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoiceSummaryInner; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; -import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoiceSummaryInner; import java.util.List; import org.joda.time.DateTime; diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Invoices.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Invoices.java index c691e046afed..ba7797f17476 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Invoices.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Invoices.java @@ -17,37 +17,37 @@ */ public interface Invoices extends HasInner { /** - * List of invoices for a billing account. + * List of invoices for a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. * @param periodStartDate Invoice period start date. * @param periodEndDate Invoice period end date. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingAccountNameAsync(String billingAccountName, String periodStartDate, String periodEndDate); + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate); /** - * List of invoices for a billing profile. + * Get the invoice by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. - * @param periodStartDate Invoice period start date. - * @param periodEndDate Invoice period end date. + * @param invoiceName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate); + Observable getAsync(String billingAccountName, String billingProfileName, String invoiceName); /** - * Get the invoice by name. + * List of invoices for a billing account. * - * @param billingAccountName billing Account Id. - * @param billingProfileName Billing Profile Id. - * @param invoiceName Invoice Id. + * @param billingAccountName Billing Account Id. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getAsync(String billingAccountName, String billingProfileName, String invoiceName); + Observable listByBillingAccountNameAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethods.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethods.java index 697e3f7d2b09..07b3095604d0 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethods.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethods.java @@ -19,7 +19,7 @@ public interface PaymentMethods extends HasInner { /** * Lists the Payment Methods by billing profile Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -29,7 +29,7 @@ public interface PaymentMethods extends HasInner { /** * Lists the Payment Methods by billing account Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policies.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policies.java index 5e420b2d3689..b5c50350cc80 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policies.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policies.java @@ -20,7 +20,7 @@ public interface Policies extends HasInner { /** * The policy for a given billing account name and billing profile name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -30,7 +30,7 @@ public interface Policies extends HasInner { /** * The operation to update a policy. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param parameters Parameters supplied to the update policy operation. * @throws IllegalArgumentException thrown if parameters fail the validation diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Products.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Products.java index d69d039b7cd9..31fc99434da6 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Products.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Products.java @@ -19,17 +19,17 @@ public interface Products extends HasInner { /** * Lists products by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName); + Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName); /** * Get a single product by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -40,7 +40,7 @@ public interface Products extends HasInner { /** * The operation to transfer a Product to another invoice section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param parameters Parameters supplied to the Transfer Product operation. @@ -52,7 +52,7 @@ public interface Products extends HasInner { /** * Validates the transfer of products across invoice sections. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param parameters Parameters supplied to the Transfer Products operation. @@ -64,7 +64,7 @@ public interface Products extends HasInner { /** * Cancel auto renew for product by product id and billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param productName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -74,7 +74,7 @@ public interface Products extends HasInner { /** * Cancel auto renew for product by product id and invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -85,7 +85,7 @@ public interface Products extends HasInner { /** * Lists products by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Reseller.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Reseller.java new file mode 100644 index 000000000000..73a36d5a7478 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Reseller.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about a reseller. + */ +public class Reseller { + /** + * The reseller id. + */ + @JsonProperty(value = "resellerId", access = JsonProperty.Access.WRITE_ONLY) + private String resellerId; + + /** + * A description of the reseller. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the reseller id. + * + * @return the resellerId value + */ + public String resellerId() { + return this.resellerId; + } + + /** + * Get a description of the reseller. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ServiceProvider.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ServiceProvider.java new file mode 100644 index 000000000000..15be32bbe74d --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ServiceProvider.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about a service provider. + */ +public class ServiceProvider { + /** + * The service provider id. + */ + @JsonProperty(value = "serviceProviderId", access = JsonProperty.Access.WRITE_ONLY) + private String serviceProviderId; + + /** + * A description of the service provider. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the service provider id. + * + * @return the serviceProviderId value + */ + public String serviceProviderId() { + return this.serviceProviderId; + } + + /** + * Get a description of the service provider. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transactions.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transactions.java index 640f3709a2e9..a87aa50d2c11 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transactions.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transactions.java @@ -19,31 +19,43 @@ public interface Transactions extends HasInner { /** * Lists the transactions by billing profile name for given start date and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param startDate Start date * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String startDate, String endDate); + Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate); /** * Lists the transactions by invoice section name for given start date and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate); + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param startDate Start date * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String startDate, String endDate); + Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate); /** * Lists the transactions by billing account name for given start and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param startDate Start date * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransactionsSummary.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransactionsSummary.java index b62704e954fe..16f111258117 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransactionsSummary.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransactionsSummary.java @@ -28,6 +28,16 @@ public interface TransactionsSummary extends HasInner, */ String billingProfileName(); + /** + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * @return the customerId value. + */ + String customerId(); + /** * @return the dateProperty value. */ diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transfers.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transfers.java index 3ab572815fa2..4be4a0d04bc5 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transfers.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transfers.java @@ -20,7 +20,7 @@ public interface Transfers extends HasInner { /** * Gets the transfer details for given transfer Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param transferName Transfer Name. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -31,7 +31,7 @@ public interface Transfers extends HasInner { /** * Lists all transfer's details initiated from given invoice section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -41,7 +41,7 @@ public interface Transfers extends HasInner { /** * Cancels the transfer for given transfer Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param transferName Transfer Name. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -52,7 +52,7 @@ public interface Transfers extends HasInner { /** * Initiates the request to transfer the legacy subscriptions or RIs. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param body Initiate transfer parameters. * @throws IllegalArgumentException thrown if parameters fail the validation diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsImpl.java index 0de89dfb4396..5e423bb6c5ca 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsImpl.java @@ -13,7 +13,7 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.Agreements; import rx.Observable; import rx.functions.Func1; -import com.microsoft.azure.management.billing.v2018_11_01_preview.AgreementListResult; +import com.microsoft.azure.Page; import com.microsoft.azure.management.billing.v2018_11_01_preview.Agreement; class AgreementsImpl extends WrapperImpl implements Agreements { @@ -33,13 +33,19 @@ private AgreementImpl wrapModel(AgreementInner inner) { } @Override - public Observable listByBillingAccountNameAsync(String billingAccountName) { + public Observable listByBillingAccountNameAsync(final String billingAccountName) { AgreementsInner client = this.inner(); return client.listByBillingAccountNameAsync(billingAccountName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public AgreementListResult call(AgreementListResultInner inner) { - return new AgreementListResultImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Agreement call(AgreementInner inner) { + return wrapModel(inner); } }); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsInner.java index ac3b2842360b..fa6773d38512 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsInner.java @@ -10,17 +10,23 @@ 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_11_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; @@ -59,57 +65,97 @@ interface AgreementsService { @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}") Observable> get(@Path("billingAccountName") String billingAccountName, @Path("agreementName") String agreementName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @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_11_01_preview.Agreements listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** * Lists all agreements for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the AgreementListResultInner object if successful. + * @return the PagedList<AgreementInner> object if successful. */ - public AgreementListResultInner listByBillingAccountName(String billingAccountName) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists all agreements for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists all agreements for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the AgreementListResultInner object + * @return the observable to the PagedList<AgreementInner> object */ - public Observable listByBillingAccountNameAsync(String billingAccountName) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, AgreementListResultInner>() { - @Override - public AgreementListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** * Lists all agreements for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the AgreementListResultInner object + * @return the PagedList<AgreementInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -118,12 +164,12 @@ public Observable> listByBillingAccoun } final String expand = null; return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -134,56 +180,93 @@ public Observable> call(Response listByBillingAccountName(final String billingAccountName, final String expand) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists all agreements for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the participants. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, String expand, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand), serviceCallback); + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists all agreements for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the participants. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the AgreementListResultInner object + * @return the observable to the PagedList<AgreementInner> object */ - public Observable listByBillingAccountNameAsync(String billingAccountName, String expand) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand).map(new Func1, AgreementListResultInner>() { - @Override - public AgreementListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Lists all agreements for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the participants. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the AgreementListResultInner object + * @return the observable to the PagedList<AgreementInner> object */ - public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand) { + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String expand) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, expand) + .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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AgreementInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String expand) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -191,12 +274,12 @@ public Observable> listByBillingAccoun throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -204,9 +287,9 @@ public Observable> call(Response listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByBillingAccountNameDelegate(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); } @@ -214,7 +297,7 @@ private ServiceResponse listByBillingAccountNameDelega /** * Get the agreement by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param agreementName Agreement Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -228,7 +311,7 @@ public AgreementInner get(String billingAccountName, String agreementName) { /** * Get the agreement by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param agreementName Agreement Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -241,7 +324,7 @@ public ServiceFuture getAsync(String billingAccountName, String /** * Get the agreement by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param agreementName Agreement Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AgreementInner object @@ -258,7 +341,7 @@ public AgreementInner call(ServiceResponse response) { /** * Get the agreement by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param agreementName Agreement Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AgreementInner object @@ -291,7 +374,7 @@ public Observable> call(Response r /** * Get the agreement by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param agreementName Agreement Id. * @param expand May be used to expand the participants. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -306,7 +389,7 @@ public AgreementInner get(String billingAccountName, String agreementName, Strin /** * Get the agreement by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param agreementName Agreement Id. * @param expand May be used to expand the participants. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -320,7 +403,7 @@ public ServiceFuture getAsync(String billingAccountName, String /** * Get the agreement by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param agreementName Agreement Id. * @param expand May be used to expand the participants. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -338,7 +421,7 @@ public AgreementInner call(ServiceResponse response) { /** * Get the agreement by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param agreementName Agreement Id. * @param expand May be used to expand the participants. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -375,4 +458,115 @@ private ServiceResponse getDelegate(Response respo .build(response); } + /** + * Lists all agreements for a billing account. + * + * @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<AgreementInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all agreements for a billing account. + * + * @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> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all agreements for a billing account. + * + * @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<AgreementInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + * @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<AgreementInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AgreementInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(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.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(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/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesInner.java index 6d15ce7d31e5..e4814f08da07 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesInner.java @@ -60,7 +60,7 @@ interface AvailableBalancesService { /** * The latest available credit balance for a given billingAccountName and billingProfileName. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -74,7 +74,7 @@ public AvailableBalanceInner getByBillingProfile(String billingAccountName, Stri /** * The latest available credit balance for a given billingAccountName and billingProfileName. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -87,7 +87,7 @@ public ServiceFuture getByBillingProfileAsync(String bill /** * The latest available credit balance for a given billingAccountName and billingProfileName. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AvailableBalanceInner object @@ -104,7 +104,7 @@ public AvailableBalanceInner call(ServiceResponse respons /** * The latest available credit balance for a given billingAccountName and billingProfileName. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AvailableBalanceInner object diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsImpl.java index a33944f1153d..223f569189cd 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsImpl.java @@ -13,8 +13,8 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccounts; import rx.functions.Func1; import rx.Observable; +import com.microsoft.azure.Page; import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccount; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccountListResult; class BillingAccountsImpl extends WrapperImpl implements BillingAccounts { private final BillingManager manager; @@ -45,13 +45,19 @@ public BillingAccount call(BillingAccountInner inner) { } @Override - public Observable listAsync() { + public Observable listAsync() { BillingAccountsInner client = this.inner(); return client.listAsync() - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public BillingAccountListResult call(BillingAccountListResultInner inner) { - return new BillingAccountListResultImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingAccount call(BillingAccountInner inner) { + return new BillingAccountImpl(inner, manager()); } }); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsInner.java index 5f23813e1564..7a74b36bbe21 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsInner.java @@ -10,13 +10,18 @@ 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_11_01_preview.BillingAccountUpdateProperties; import com.microsoft.azure.management.billing.v2018_11_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 com.microsoft.rest.Validator; import java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; @@ -25,6 +30,7 @@ import retrofit2.http.PATCH; import retrofit2.http.Path; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -71,64 +77,103 @@ interface BillingAccountsService { @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}") Observable> beginUpdate(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body BillingAccountUpdateProperties parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccounts listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** - * Lists all billing accounts for a user which he has access to. + * Lists all billing accounts for which a user has access. * * @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 BillingAccountListResultInner object if successful. + * @return the PagedList<BillingAccountInner> object if successful. */ - public BillingAccountListResultInner list() { - return listWithServiceResponseAsync().toBlocking().single().body(); + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Lists all billing accounts for a user which he has access to. + * Lists all billing accounts for which a user has access. * * @param serviceCallback 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 ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Lists all billing accounts for a user which he has access to. + * Lists all billing accounts for which a user has access. * * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingAccountListResultInner object + * @return the observable to the PagedList<BillingAccountInner> object */ - public Observable listAsync() { - return listWithServiceResponseAsync().map(new Func1, BillingAccountListResultInner>() { - @Override - public BillingAccountListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all billing accounts for which a user has access. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** - * Lists all billing accounts for a user which he has access to. + * Lists all billing accounts for which a user has access. * * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingAccountListResultInner object + * @return the PagedList<BillingAccountInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listWithServiceResponseAsync() { + public Observable>> listSinglePageAsync() { if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } final String expand = null; return service.list(this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -137,64 +182,100 @@ public Observable> call(Response< } /** - * Lists all billing accounts for a user which he has access to. + * Lists all billing accounts for which a user has access. * * @param expand May be used to expand the invoiceSections and billingProfiles. * @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 BillingAccountListResultInner object if successful. + * @return the PagedList<BillingAccountInner> object if successful. */ - public BillingAccountListResultInner list(String expand) { - return listWithServiceResponseAsync(expand).toBlocking().single().body(); + public PagedList list(final String expand) { + ServiceResponse> response = listSinglePageAsync(expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Lists all billing accounts for a user which he has access to. + * Lists all billing accounts for which a user has access. * * @param expand May be used to expand the invoiceSections and billingProfiles. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listAsync(String expand, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listWithServiceResponseAsync(expand), serviceCallback); + public ServiceFuture> listAsync(final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Lists all billing accounts for a user which he has access to. + * Lists all billing accounts for which a user has access. * * @param expand May be used to expand the invoiceSections and billingProfiles. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingAccountListResultInner object + * @return the observable to the PagedList<BillingAccountInner> object */ - public Observable listAsync(String expand) { - return listWithServiceResponseAsync(expand).map(new Func1, BillingAccountListResultInner>() { - @Override - public BillingAccountListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listAsync(final String expand) { + return listWithServiceResponseAsync(expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Lists all billing accounts for a user which he has access to. + * Lists all billing accounts for which a user has access. * * @param expand May be used to expand the invoiceSections and billingProfiles. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingAccountListResultInner object + * @return the observable to the PagedList<BillingAccountInner> object */ - public Observable> listWithServiceResponseAsync(String expand) { + public Observable>> listWithServiceResponseAsync(final String expand) { + return listSinglePageAsync(expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all billing accounts for which a user has access. + * + ServiceResponse> * @param expand May be used to expand the invoiceSections and billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String expand) { if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.list(this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -202,9 +283,9 @@ public Observable> call(Response< }); } - private ServiceResponse listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + 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); } @@ -212,7 +293,7 @@ private ServiceResponse listDelegate(Response getAsync(String billingAccountName, fi /** * Get the billing account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingAccountInner object */ @@ -253,7 +334,7 @@ public BillingAccountInner call(ServiceResponse response) { /** * Get the billing account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingAccountInner object */ @@ -282,7 +363,7 @@ public Observable> call(Response getAsync(String billingAccountName, St /** * Get the billing account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the invoiceSections and billingProfiles. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingAccountInner object @@ -326,7 +407,7 @@ public BillingAccountInner call(ServiceResponse response) { /** * Get the billing account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the invoiceSections and billingProfiles. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingAccountInner object @@ -362,7 +443,7 @@ private ServiceResponse getDelegate(Response /** * The operation to update a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the update billing account operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -376,7 +457,7 @@ public BillingAccountInner update(String billingAccountName, BillingAccountUpdat /** * The operation to update a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the update billing account operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -389,7 +470,7 @@ public ServiceFuture updateAsync(String billingAccountName, /** * The operation to update a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the update billing account operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -406,7 +487,7 @@ public BillingAccountInner call(ServiceResponse response) { /** * The operation to update a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the update billing account operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -429,7 +510,7 @@ public Observable> updateWithServiceRespons /** * The operation to update a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the update billing account operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -443,7 +524,7 @@ public BillingAccountInner beginUpdate(String billingAccountName, BillingAccount /** * The operation to update a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the update billing account operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -456,7 +537,7 @@ public ServiceFuture beginUpdateAsync(String billingAccount /** * The operation to update a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the update billing account operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingAccountInner object @@ -473,7 +554,7 @@ public BillingAccountInner call(ServiceResponse response) { /** * The operation to update a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the update billing account operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingAccountInner object @@ -511,4 +592,115 @@ private ServiceResponse beginUpdateDelegate(Response listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all billing accounts for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all billing accounts for which a user has access. + * + * @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<BillingAccountInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all billing accounts for which a user has access. + * + * @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<BillingAccountInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all billing accounts for which a user has access. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingAccountInner> 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/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java index f0a669d8b09c..7b8a4cbf10f4 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java @@ -40,11 +40,11 @@ public String apiVersion() { return this.apiVersion; } - /** Azure Subscription ID. */ + /** Azure Subscription Id. */ private String subscriptionId; /** - * Gets Azure Subscription ID. + * Gets Azure Subscription Id. * * @return the subscriptionId value. */ @@ -53,7 +53,7 @@ public String subscriptionId() { } /** - * Sets Azure Subscription ID. + * Sets Azure Subscription Id. * * @param subscriptionId the subscriptionId value. * @return the service client itself @@ -197,6 +197,19 @@ public BillingProfilesInner billingProfiles() { return this.billingProfiles; } + /** + * The CustomersInner object to access its operations. + */ + private CustomersInner customers; + + /** + * Gets the CustomersInner object to access its operations. + * @return the CustomersInner object. + */ + public CustomersInner customers() { + return this.customers; + } + /** * The InvoiceSectionsInner object to access its operations. */ @@ -471,6 +484,7 @@ protected void initialize() { this.addresses = new AddressesInner(restClient().retrofit(), this); this.availableBalances = new AvailableBalancesInner(restClient().retrofit(), this); this.billingProfiles = new BillingProfilesInner(restClient().retrofit(), this); + this.customers = new CustomersInner(restClient().retrofit(), this); this.invoiceSections = new InvoiceSectionsInner(restClient().retrofit(), this); this.departments = new DepartmentsInner(restClient().retrofit(), this); this.enrollmentAccounts = new EnrollmentAccountsInner(restClient().retrofit(), this); diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java index 2dec543494a7..8040b1c8ede7 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java @@ -21,6 +21,7 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.Addresses; import com.microsoft.azure.management.billing.v2018_11_01_preview.AvailableBalances; import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfiles; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Customers; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections; import com.microsoft.azure.management.billing.v2018_11_01_preview.Departments; import com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccounts; @@ -51,6 +52,7 @@ public final class BillingManager extends ManagerCore listByCustomersAsync(String billingAccountName, String customerName) { + BillingPermissionsInner client = this.inner(); + return client.listByCustomersAsync(billingAccountName, customerName) + .map(new Func1() { + @Override + public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { + return new BillingPermissionsListResultImpl(inner, manager()); + } + }); + } + @Override public Observable listByInvoiceSectionsAsync(String billingAccountName, String invoiceSectionName) { BillingPermissionsInner client = this.inner(); diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsInner.java index 50c5a11a5be8..d18f92a3639a 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsInner.java @@ -55,6 +55,10 @@ interface BillingPermissionsService { @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingPermissions") Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @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_11_01_preview.BillingPermissions listByCustomers" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/providers/Microsoft.Billing/billingPermissions") + Observable> listByCustomers(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @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_11_01_preview.BillingPermissions listByInvoiceSections" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingPermissions") Observable> listByInvoiceSections(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -68,7 +72,7 @@ interface BillingPermissionsService { /** * Lists all billing permissions for the caller under a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -81,7 +85,7 @@ public BillingPermissionsListResultInner listByBillingAccount(String billingAcco /** * Lists all billing permissions for the caller under a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -93,7 +97,7 @@ public ServiceFuture listByBillingAccountAsyn /** * Lists all billing permissions for the caller under a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingPermissionsListResultInner object */ @@ -109,7 +113,7 @@ public BillingPermissionsListResultInner call(ServiceResponse listByBillingAccountD .build(response); } + /** + * Lists all billing permissions for the caller under customer. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByCustomers(String billingAccountName, String customerName) { + return listByCustomersWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Lists all billing permissions for the caller under customer. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByCustomersAsync(String billingAccountName, String customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByCustomersWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Lists all billing permissions for the caller under customer. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable listByCustomersAsync(String billingAccountName, String customerName) { + return listByCustomersWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all billing permissions for the caller under customer. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable> listByCustomersWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName 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.listByCustomers(billingAccountName, customerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByCustomersDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByCustomersDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * Lists all billing permissions for the caller under invoice section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -158,7 +245,7 @@ public BillingPermissionsListResultInner listByInvoiceSections(String billingAcc /** * Lists all billing permissions for the caller under invoice section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -171,7 +258,7 @@ public ServiceFuture listByInvoiceSectionsAsy /** * Lists all billing permissions for the caller under invoice section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingPermissionsListResultInner object @@ -188,7 +275,7 @@ public BillingPermissionsListResultInner call(ServiceResponse listByInvoiceSections /** * Lists all billingPermissions for the caller has for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -241,7 +328,7 @@ public BillingPermissionsListResultInner listByBillingProfile(String billingAcco /** * Lists all billingPermissions for the caller has for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -254,7 +341,7 @@ public ServiceFuture listByBillingProfileAsyn /** * Lists all billingPermissions for the caller has for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingPermissionsListResultInner object @@ -271,7 +358,7 @@ public BillingPermissionsListResultInner call(ServiceResponse listByBillingAccountNameAsync(String billingAccountName) { + public Observable listByBillingAccountNameAsync(final String billingAccountName) { BillingProfilesInner client = this.inner(); return client.listByBillingAccountNameAsync(billingAccountName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public BillingProfileListResult call(BillingProfileListResultInner inner) { - return new BillingProfileListResultImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingProfile call(BillingProfileInner inner) { + return wrapModel(inner); } }); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesInner.java index 80e68f27667c..6ba69b3a0118 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesInner.java @@ -10,16 +10,21 @@ 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_11_01_preview.BillingProfileCreationParameters; import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfilesCreateHeaders; import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfilesUpdateHeaders; import com.microsoft.azure.management.billing.v2018_11_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 com.microsoft.rest.ServiceResponseWithHeaders; import com.microsoft.rest.Validator; import java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; @@ -29,6 +34,7 @@ import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -83,57 +89,97 @@ interface BillingProfilesService { @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") Observable> beginUpdate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body BillingProfileInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfiles listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** * Lists all billing profiles for a user which that user has access to. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the BillingProfileListResultInner object if successful. + * @return the PagedList<BillingProfileInner> object if successful. */ - public BillingProfileListResultInner listByBillingAccountName(String billingAccountName) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists all billing profiles for a user which that user has access to. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists all billing profiles for a user which that user has access to. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingProfileListResultInner object + * @return the observable to the PagedList<BillingProfileInner> object */ - public Observable listByBillingAccountNameAsync(String billingAccountName) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, BillingProfileListResultInner>() { - @Override - public BillingProfileListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** * Lists all billing profiles for a user which that user has access to. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingProfileListResultInner object + * @return the PagedList<BillingProfileInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -142,12 +188,12 @@ public Observable> listByBillingA } final String expand = null; return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -158,56 +204,93 @@ public Observable> call(Response< /** * Lists all billing profiles for a user which that user has access to. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the invoiceSections. * @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 BillingProfileListResultInner object if successful. + * @return the PagedList<BillingProfileInner> object if successful. */ - public BillingProfileListResultInner listByBillingAccountName(String billingAccountName, String expand) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand).toBlocking().single().body(); + public PagedList listByBillingAccountName(final String billingAccountName, final String expand) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists all billing profiles for a user which that user has access to. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the invoiceSections. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, String expand, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand), serviceCallback); + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists all billing profiles for a user which that user has access to. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the invoiceSections. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingProfileListResultInner object + * @return the observable to the PagedList<BillingProfileInner> object */ - public Observable listByBillingAccountNameAsync(String billingAccountName, String expand) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand).map(new Func1, BillingProfileListResultInner>() { - @Override - public BillingProfileListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Lists all billing profiles for a user which that user has access to. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the invoiceSections. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingProfileListResultInner object + * @return the observable to the PagedList<BillingProfileInner> object */ - public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand) { + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String expand) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, expand) + .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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param expand May be used to expand the invoiceSections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String expand) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -215,12 +298,12 @@ public Observable> listByBillingA throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -228,9 +311,9 @@ public Observable> call(Response< }); } - private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByBillingAccountNameDelegate(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); } @@ -238,7 +321,7 @@ private ServiceResponse listByBillingAccountNameD /** * The operation to create a BillingProfile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the Create BillingProfile operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -252,7 +335,7 @@ public BillingProfileInner create(String billingAccountName, BillingProfileCreat /** * The operation to create a BillingProfile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the Create BillingProfile operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -265,7 +348,7 @@ public ServiceFuture createAsync(String billingAccountName, /** * The operation to create a BillingProfile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the Create BillingProfile operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -282,7 +365,7 @@ public BillingProfileInner call(ServiceResponseWithHeaders beginCreateAsync(String billingAccount /** * The operation to create a BillingProfile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the Create BillingProfile operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingProfileInner object @@ -349,7 +432,7 @@ public BillingProfileInner call(ServiceResponseWithHeaders getAsync(String billingAccountName, St /** * Get the billing profile by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingProfileInner object @@ -434,7 +517,7 @@ public BillingProfileInner call(ServiceResponse response) { /** * Get the billing profile by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingProfileInner object @@ -467,7 +550,7 @@ public Observable> call(Response getAsync(String billingAccountName, St /** * Get the billing profile by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param expand May be used to expand the invoiceSections. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -514,7 +597,7 @@ public BillingProfileInner call(ServiceResponse response) { /** * Get the billing profile by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param expand May be used to expand the invoiceSections. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -554,7 +637,7 @@ private ServiceResponse getDelegate(Response /** * The operation to update a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param parameters Parameters supplied to the update billing profile operation. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -569,7 +652,7 @@ public BillingProfileInner update(String billingAccountName, String billingProfi /** * The operation to update a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param parameters Parameters supplied to the update billing profile operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -583,7 +666,7 @@ public ServiceFuture updateAsync(String billingAccountName, /** * The operation to update a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param parameters Parameters supplied to the update billing profile operation. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -601,7 +684,7 @@ public BillingProfileInner call(ServiceResponseWithHeaders beginUpdateAsync(String billingAccount /** * The operation to update a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param parameters Parameters supplied to the update billing profile operation. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -675,7 +758,7 @@ public BillingProfileInner call(ServiceResponseWithHeaders listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all billing profiles for a user which that user 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> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all billing profiles for a user which that user 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<BillingProfileInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all billing profiles for a user which that user 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<BillingProfileInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all billing profiles for a user which that user 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<BillingProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(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.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(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/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsInner.java index 37c0d1c6d4de..315c19452834 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsInner.java @@ -109,7 +109,7 @@ interface BillingRoleAssignmentsService { /** * Get the role assignment for the caller. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -123,7 +123,7 @@ public BillingRoleAssignmentInner getByBillingAccount(String billingAccountName, /** * Get the role assignment for the caller. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingRoleAssignmentName role assignment id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -136,7 +136,7 @@ public ServiceFuture getByBillingAccountAsync(String /** * Get the role assignment for the caller. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleAssignmentInner object @@ -153,7 +153,7 @@ public BillingRoleAssignmentInner call(ServiceResponse getByBillingAccountDelegate( /** * Delete the role assignment on this billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -206,7 +206,7 @@ public BillingRoleAssignmentInner deleteByBillingAccountName(String billingAccou /** * Delete the role assignment on this billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingRoleAssignmentName role assignment id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -219,7 +219,7 @@ public ServiceFuture deleteByBillingAccountNameAsync /** * Delete the role assignment on this billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleAssignmentInner object @@ -236,7 +236,7 @@ public BillingRoleAssignmentInner call(ServiceResponse deleteByBillingAccountNameDe /** * Get the role assignment for the caller on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -290,7 +290,7 @@ public BillingRoleAssignmentInner getByInvoiceSectionName(String billingAccountN /** * Get the role assignment for the caller on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingRoleAssignmentName role assignment id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -304,7 +304,7 @@ public ServiceFuture getByInvoiceSectionNameAsync(St /** * Get the role assignment for the caller on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -322,7 +322,7 @@ public BillingRoleAssignmentInner call(ServiceResponse getByInvoiceSectionNameDeleg /** * Delete the role assignment on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -380,7 +380,7 @@ public BillingRoleAssignmentInner deleteByInvoiceSectionName(String billingAccou /** * Delete the role assignment on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingRoleAssignmentName role assignment id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -394,7 +394,7 @@ public ServiceFuture deleteByInvoiceSectionNameAsync /** * Delete the role assignment on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -412,7 +412,7 @@ public BillingRoleAssignmentInner call(ServiceResponse deleteByInvoiceSectionNameDe /** * Get the role assignment for the caller on the Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -470,7 +470,7 @@ public BillingRoleAssignmentInner getByBillingProfileName(String billingAccountN /** * Get the role assignment for the caller on the Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param billingRoleAssignmentName role assignment id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -484,7 +484,7 @@ public ServiceFuture getByBillingProfileNameAsync(St /** * Get the role assignment for the caller on the Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -502,7 +502,7 @@ public BillingRoleAssignmentInner call(ServiceResponse getByBillingProfileNameDeleg /** * Delete the role assignment on this Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -560,7 +560,7 @@ public BillingRoleAssignmentInner deleteByBillingProfileName(String billingAccou /** * Delete the role assignment on this Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param billingRoleAssignmentName role assignment id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -574,7 +574,7 @@ public ServiceFuture deleteByBillingProfileNameAsync /** * Delete the role assignment on this Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param billingRoleAssignmentName role assignment id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -592,7 +592,7 @@ public BillingRoleAssignmentInner call(ServiceResponse deleteByBillingProfileNameDe /** * Get the role assignments on the Billing Account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -648,7 +648,7 @@ public BillingRoleAssignmentListResultInner listByBillingAccountName(String bill /** * Get the role assignments on the Billing Account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -660,7 +660,7 @@ public ServiceFuture listByBillingAccountN /** * Get the role assignments on the Billing Account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleAssignmentListResultInner object */ @@ -676,7 +676,7 @@ public BillingRoleAssignmentListResultInner call(ServiceResponse listByBillingAccou /** * The operation to add a role assignment to a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to add a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -725,7 +725,7 @@ public BillingRoleAssignmentListResultInner addByBillingAccountName(String billi /** * The operation to add a role assignment to a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to add a role assignment. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -738,7 +738,7 @@ public ServiceFuture addByBillingAccountNa /** * The operation to add a role assignment to a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to add a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleAssignmentListResultInner object @@ -755,7 +755,7 @@ public BillingRoleAssignmentListResultInner call(ServiceResponse addByBillingAccoun /** * Get the role assignments on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -809,7 +809,7 @@ public BillingRoleAssignmentListResultInner listByInvoiceSectionName(String bill /** * Get the role assignments on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -822,7 +822,7 @@ public ServiceFuture listByInvoiceSectionN /** * Get the role assignments on the invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleAssignmentListResultInner object @@ -839,7 +839,7 @@ public BillingRoleAssignmentListResultInner call(ServiceResponse listByInvoiceSecti /** * The operation to add a role assignment to a invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param parameters Parameters supplied to add a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -893,7 +893,7 @@ public BillingRoleAssignmentListResultInner addByInvoiceSectionName(String billi /** * The operation to add a role assignment to a invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param parameters Parameters supplied to add a role assignment. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -907,7 +907,7 @@ public ServiceFuture addByInvoiceSectionNa /** * The operation to add a role assignment to a invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param parameters Parameters supplied to add a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -925,7 +925,7 @@ public BillingRoleAssignmentListResultInner call(ServiceResponse addByInvoiceSectio /** * Get the role assignments on the Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -983,7 +983,7 @@ public BillingRoleAssignmentListResultInner listByBillingProfileName(String bill /** * Get the role assignments on the Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -996,7 +996,7 @@ public ServiceFuture listByBillingProfileN /** * Get the role assignments on the Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleAssignmentListResultInner object @@ -1013,7 +1013,7 @@ public BillingRoleAssignmentListResultInner call(ServiceResponse listByBillingProfi /** * The operation to add a role assignment to a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param parameters Parameters supplied to add a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -1067,7 +1067,7 @@ public BillingRoleAssignmentListResultInner addByBillingProfileName(String billi /** * The operation to add a role assignment to a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param parameters Parameters supplied to add a role assignment. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -1081,7 +1081,7 @@ public ServiceFuture addByBillingProfileNa /** * The operation to add a role assignment to a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param parameters Parameters supplied to add a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -1099,7 +1099,7 @@ public BillingRoleAssignmentListResultInner call(ServiceResponse getByBillingAccountNameAsync(St /** * Gets the role definition for a role. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingRoleDefinitionName role definition id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleDefinitionInner object @@ -124,7 +124,7 @@ public BillingRoleDefinitionInner call(ServiceResponse getByBillingAccountNameDeleg /** * Gets the role definition for a role. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingRoleDefinitionName role definition id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -178,7 +178,7 @@ public BillingRoleDefinitionInner getByInvoiceSectionName(String billingAccountN /** * Gets the role definition for a role. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingRoleDefinitionName role definition id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -192,7 +192,7 @@ public ServiceFuture getByInvoiceSectionNameAsync(St /** * Gets the role definition for a role. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingRoleDefinitionName role definition id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -210,7 +210,7 @@ public BillingRoleDefinitionInner call(ServiceResponse getByInvoiceSectionNameDeleg /** * Gets the role definition for a role. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param billingRoleDefinitionName role definition id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -268,7 +268,7 @@ public BillingRoleDefinitionInner getByBillingProfileName(String billingAccountN /** * Gets the role definition for a role. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param billingRoleDefinitionName role definition id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -282,7 +282,7 @@ public ServiceFuture getByBillingProfileNameAsync(St /** * Gets the role definition for a role. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param billingRoleDefinitionName role definition id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -300,7 +300,7 @@ public BillingRoleDefinitionInner call(ServiceResponse getByBillingProfileNameDeleg /** * Lists the role definition for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -356,7 +356,7 @@ public BillingRoleDefinitionListResultInner listByBillingAccountName(String bill /** * Lists the role definition for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -368,7 +368,7 @@ public ServiceFuture listByBillingAccountN /** * Lists the role definition for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleDefinitionListResultInner object */ @@ -384,7 +384,7 @@ public BillingRoleDefinitionListResultInner call(ServiceResponse listByBillingAccou /** * Lists the role definition for an invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -433,7 +433,7 @@ public BillingRoleDefinitionListResultInner listByInvoiceSectionName(String bill /** * Lists the role definition for an invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -446,7 +446,7 @@ public ServiceFuture listByInvoiceSectionN /** * Lists the role definition for an invoice Section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleDefinitionListResultInner object @@ -463,7 +463,7 @@ public BillingRoleDefinitionListResultInner call(ServiceResponse listByInvoiceSecti /** * Lists the role definition for a Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -516,7 +516,7 @@ public BillingRoleDefinitionListResultInner listByBillingProfileName(String bill /** * Lists the role definition for a Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -529,7 +529,7 @@ public ServiceFuture listByBillingProfileN /** * Lists the role definition for a Billing Profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleDefinitionListResultInner object @@ -546,7 +546,7 @@ public BillingRoleDefinitionListResultInner call(ServiceResponse listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + public Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName) { BillingSubscriptionsInner client = this.inner(); return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByCustomerNameAsync(final String billingAccountName, final String customerName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByCustomerNameAsync(billingAccountName, customerName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByCustomerNameAsync(String billingAccountName, String customerName, String billingSubscriptionName) { + BillingSubscriptionsInner client = this.inner(); + return client.getByCustomerNameAsync(billingAccountName, customerName, billingSubscriptionName) + .map(new Func1() { @Override - public BillingSubscriptionsListResult call(BillingSubscriptionsListResultInner inner) { - return new BillingSubscriptionsListResultImpl(inner, manager()); + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); } }); } @Override - public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + public Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName) { BillingSubscriptionsInner client = this.inner(); return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public BillingSubscriptionsListResult call(BillingSubscriptionsListResultInner inner) { - return new BillingSubscriptionsListResultImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); } }); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsInner.java index d80144b4800b..c3751dd8abfc 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsInner.java @@ -71,6 +71,14 @@ interface BillingSubscriptionsService { @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions") Observable> listByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @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_11_01_preview.BillingSubscriptions listByCustomerName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions") + Observable> listByCustomerName(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @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_11_01_preview.BillingSubscriptions getByCustomerName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions/{billingSubscriptionName}") + Observable> getByCustomerName(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Path("billingSubscriptionName") String billingSubscriptionName, @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_11_01_preview.BillingSubscriptions listByInvoiceSectionName" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions") Observable> listByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -95,12 +103,24 @@ interface BillingSubscriptionsService { @GET Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions listByBillingProfileNameNext" }) + @GET + Observable> listByBillingProfileNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions listByCustomerNameNext" }) + @GET + Observable> listByCustomerNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions listByInvoiceSectionNameNext" }) + @GET + Observable> listByInvoiceSectionNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** * Lists billing subscriptions by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -119,7 +139,7 @@ public Page nextPage(String nextPageLink) { /** * Lists billing subscriptions by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -139,7 +159,7 @@ public Observable>> call(S /** * Lists billing subscriptions by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object */ @@ -156,7 +176,7 @@ public Page call(ServiceResponse>> call(S /** * Lists billing subscriptions by billing account name. * - ServiceResponse> * @param billingAccountName billing Account Id. + ServiceResponse> * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -212,56 +232,93 @@ private ServiceResponse> listByBilling /** * Lists billing subscriptions by billing profile name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the BillingSubscriptionsListResultInner object if successful. + * @return the PagedList<BillingSubscriptionSummaryInner> object if successful. */ - public BillingSubscriptionsListResultInner listByBillingProfileName(String billingAccountName, String billingProfileName) { - return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + public PagedList listByBillingProfileName(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists billing subscriptions by billing profile name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + public ServiceFuture> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists billing subscriptions by billing profile name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingSubscriptionsListResultInner object + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object */ - public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { - return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingSubscriptionsListResultInner>() { - @Override - public BillingSubscriptionsListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Lists billing subscriptions by billing profile name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingSubscriptionsListResultInner object + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByBillingProfileNameWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName) + .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(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscriptions by billing profile name. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + public Observable>> listByBillingProfileNameSinglePageAsync(final String billingAccountName, final String billingProfileName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -272,12 +329,12 @@ public Observable> listByBi throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingProfileNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingProfileNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -285,82 +342,119 @@ public Observable> call(Res }); } - private ServiceResponse listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(ErrorResponseException.class) .build(response); } /** - * Lists billing subscription by invoice section name. + * Lists billing subscription by customer name. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the BillingSubscriptionsListResultInner object if successful. + * @return the PagedList<BillingSubscriptionSummaryInner> object if successful. */ - public BillingSubscriptionsListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName) { - return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + public PagedList listByCustomerName(final String billingAccountName, final String customerName) { + ServiceResponse> response = listByCustomerNameSinglePageAsync(billingAccountName, customerName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Lists billing subscription by invoice section name. + * Lists billing subscription by customer name. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName), serviceCallback); + public ServiceFuture> listByCustomerNameAsync(final String billingAccountName, final String customerName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNameSinglePageAsync(billingAccountName, customerName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Lists billing subscription by invoice section name. + * Lists billing subscription by customer name. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingSubscriptionsListResultInner object + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object */ - public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { - return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).map(new Func1, BillingSubscriptionsListResultInner>() { - @Override - public BillingSubscriptionsListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByCustomerNameAsync(final String billingAccountName, final String customerName) { + return listByCustomerNameWithServiceResponseAsync(billingAccountName, customerName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Lists billing subscription by invoice section name. + * Lists billing subscription by customer name. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByCustomerNameWithServiceResponseAsync(final String billingAccountName, final String customerName) { + return listByCustomerNameSinglePageAsync(billingAccountName, customerName) + .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(listByCustomerNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscription by customer name. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param customerName Customer Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingSubscriptionsListResultInner object + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName) { + public Observable>> listByCustomerNameSinglePageAsync(final String billingAccountName, final String customerName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } - if (invoiceSectionName == null) { - throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName 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.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listByCustomerName(billingAccountName, customerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByCustomerNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -368,9 +462,9 @@ public Observable> call(Res }); } - private ServiceResponse listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByCustomerNameDelegate(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); } @@ -378,43 +472,43 @@ private ServiceResponse listByInvoiceSectio /** * Get a single billing subscription by name. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @param billingSubscriptionName Billing Subscription Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the BillingSubscriptionSummaryInner object if successful. */ - public BillingSubscriptionSummaryInner get(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { - return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).toBlocking().single().body(); + public BillingSubscriptionSummaryInner getByCustomerName(String billingAccountName, String customerName, String billingSubscriptionName) { + return getByCustomerNameWithServiceResponseAsync(billingAccountName, customerName, billingSubscriptionName).toBlocking().single().body(); } /** * Get a single billing subscription by name. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @param billingSubscriptionName Billing Subscription Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName), serviceCallback); + public ServiceFuture getByCustomerNameAsync(String billingAccountName, String customerName, String billingSubscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByCustomerNameWithServiceResponseAsync(billingAccountName, customerName, billingSubscriptionName), serviceCallback); } /** * Get a single billing subscription by name. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @param billingSubscriptionName Billing Subscription Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingSubscriptionSummaryInner object */ - public Observable getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { - return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).map(new Func1, BillingSubscriptionSummaryInner>() { + public Observable getByCustomerNameAsync(String billingAccountName, String customerName, String billingSubscriptionName) { + return getByCustomerNameWithServiceResponseAsync(billingAccountName, customerName, billingSubscriptionName).map(new Func1, BillingSubscriptionSummaryInner>() { @Override public BillingSubscriptionSummaryInner call(ServiceResponse response) { return response.body(); @@ -425,18 +519,18 @@ public BillingSubscriptionSummaryInner call(ServiceResponse> getWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + public Observable> getByCustomerNameWithServiceResponseAsync(String billingAccountName, String customerName, String billingSubscriptionName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } - if (invoiceSectionName == null) { - throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); } if (billingSubscriptionName == null) { throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); @@ -444,12 +538,12 @@ public Observable> getWithServi if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.get(billingAccountName, invoiceSectionName, billingSubscriptionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + return service.getByCustomerName(billingAccountName, customerName, billingSubscriptionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = getDelegate(response); + ServiceResponse clientResponse = getByCustomerNameDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -458,7 +552,7 @@ public Observable> call(Respons }); } - private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + private ServiceResponse getByCustomerNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorResponseException.class) @@ -466,140 +560,350 @@ private ServiceResponse getDelegate(Response listByInvoiceSectionName(final String billingAccountName, final String invoiceSectionName) { + ServiceResponse> response = listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Transfers the subscription from one invoice section to another within a billing account. + * Lists billing subscription by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. - * @param billingSubscriptionName Billing Subscription Id. - * @param parameters Parameters supplied to the Transfer Billing Subscription operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromHeaderResponse(transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters), serviceCallback); + public ServiceFuture> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Transfers the subscription from one invoice section to another within a billing account. + * Lists billing subscription by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. - * @param billingSubscriptionName Billing Subscription Id. - * @param parameters Parameters supplied to the Transfer Billing Subscription operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object */ - public Observable transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { - return transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).map(new Func1, TransferBillingSubscriptionResultInner>() { - @Override - public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { - return response.body(); - } - }); + public Observable> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Transfers the subscription from one invoice section to another within a billing account. + * Lists billing subscription by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. - * @param billingSubscriptionName Billing Subscription Id. - * @param parameters Parameters supplied to the Transfer Billing Subscription operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object */ - public Observable> transferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + public Observable>> listByInvoiceSectionNameWithServiceResponseAsync(final String billingAccountName, final String invoiceSectionName) { + return listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName) + .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(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscription by invoice section name. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameSinglePageAsync(final String billingAccountName, final String invoiceSectionName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } if (invoiceSectionName == null) { throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); } - if (billingSubscriptionName == null) { - throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); - } - if (parameters == null) { - throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - Validator.validate(parameters); - Observable> observable = service.transfer(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingSubscriptionsTransferHeaders.class); + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNameDelegate(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); } /** - * Transfers the subscription from one invoice section to another within a billing account. + * Get a single billing subscription by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingSubscriptionName Billing Subscription Id. - * @param parameters Parameters supplied to the Transfer Billing Subscription 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 TransferBillingSubscriptionResultInner object if successful. + * @return the BillingSubscriptionSummaryInner object if successful. */ - public TransferBillingSubscriptionResultInner beginTransfer(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { - return beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).toBlocking().single().body(); + public BillingSubscriptionSummaryInner get(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).toBlocking().single().body(); } /** - * Transfers the subscription from one invoice section to another within a billing account. + * Get a single billing subscription by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingSubscriptionName Billing Subscription Id. - * @param parameters Parameters supplied to the Transfer Billing Subscription operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromHeaderResponse(beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters), serviceCallback); + public ServiceFuture getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName), serviceCallback); } /** - * Transfers the subscription from one invoice section to another within a billing account. + * Get a single billing subscription by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingSubscriptionName Billing Subscription Id. - * @param parameters Parameters supplied to the Transfer Billing Subscription operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TransferBillingSubscriptionResultInner object + * @return the observable to the BillingSubscriptionSummaryInner object */ - public Observable beginTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { - return beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).map(new Func1, TransferBillingSubscriptionResultInner>() { + public Observable getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).map(new Func1, BillingSubscriptionSummaryInner>() { @Override - public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { + public BillingSubscriptionSummaryInner call(ServiceResponse response) { return response.body(); } }); } /** - * Transfers the subscription from one invoice section to another within a billing account. + * Get a single billing subscription by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingSubscriptionName Billing Subscription Id. - * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionSummaryInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName 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(billingAccountName, invoiceSectionName, billingSubscriptionName, 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); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription 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 TransferBillingSubscriptionResultInner object if successful. + */ + public TransferBillingSubscriptionResultInner transfer(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).toBlocking().last().body(); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters), serviceCallback); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).map(new Func1, TransferBillingSubscriptionResultInner>() { + @Override + public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> transferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.transfer(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingSubscriptionsTransferHeaders.class); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription 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 TransferBillingSubscriptionResultInner object if successful. + */ + public TransferBillingSubscriptionResultInner beginTransfer(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).toBlocking().single().body(); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters), serviceCallback); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferBillingSubscriptionResultInner object + */ + public Observable beginTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).map(new Func1, TransferBillingSubscriptionResultInner>() { + @Override + public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the TransferBillingSubscriptionResultInner object */ @@ -642,7 +946,7 @@ private ServiceResponseWithHeaders validat /** * Validates the transfer of billing subscriptions across invoice sections. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param billingSubscriptionName Billing Subscription Id. * @param parameters Parameters supplied to the Transfer Billing Subscription operation. @@ -692,7 +996,7 @@ public ValidateSubscriptionTransferEligibilityResultInner call(ServiceResponse> listByBilling .build(response); } + /** + * Lists billing subscriptions by billing profile name. + * + * @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<BillingSubscriptionSummaryInner> object if successful. + */ + public PagedList listByBillingProfileNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @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> listByBillingProfileNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @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<BillingSubscriptionSummaryInner> object + */ + public Observable> listByBillingProfileNameNextAsync(final String nextPageLink) { + return listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @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<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByBillingProfileNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(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(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscriptions by billing profile name. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameNextSinglePageAsync(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.listByBillingProfileNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists billing subscription by customer name. + * + * @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<BillingSubscriptionSummaryInner> object if successful. + */ + public PagedList listByCustomerNameNext(final String nextPageLink) { + ServiceResponse> response = listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists billing subscription by customer name. + * + * @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> listByCustomerNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists billing subscription by customer name. + * + * @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<BillingSubscriptionSummaryInner> object + */ + public Observable> listByCustomerNameNextAsync(final String nextPageLink) { + return listByCustomerNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscription by customer name. + * + * @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<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByCustomerNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(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(listByCustomerNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscription by customer name. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNameNextSinglePageAsync(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.listByCustomerNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists billing subscription by invoice section name. + * + * @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<BillingSubscriptionSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionNameNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists billing subscription by invoice section name. + * + * @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> listByInvoiceSectionNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists billing subscription by invoice section name. + * + * @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<BillingSubscriptionSummaryInner> object + */ + public Observable> listByInvoiceSectionNameNextAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscription by invoice section name. + * + * @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<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(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(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscription by invoice section name. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameNextSinglePageAsync(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.listByInvoiceSectionNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNameNextDelegate(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/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerImpl.java new file mode 100644 index 000000000000..b6a8373c0bfd --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerImpl.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.Customer; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.EnabledAzureSKUs; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Reseller; + +class CustomerImpl extends IndexableRefreshableWrapperImpl implements Customer { + private final BillingManager manager; + private String billingAccountName; + private String customerName; + + CustomerImpl(CustomerInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.customerName = IdParsingUtils.getValueFromIdByName(inner.id(), "customers"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + CustomersInner client = this.manager().inner().customers(); + return client.getAsync(this.billingAccountName, this.customerName); + } + + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List enabledAzureSKUs() { + return this.inner().enabledAzureSKUs(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List resellers() { + return this.inner().resellers(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerInner.java new file mode 100644 index 000000000000..9491faab977f --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerInner.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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_11_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.EnabledAzureSKUs; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Reseller; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A partner's customer. + */ +@JsonFlatten +public class CustomerInner extends ProxyResource { + /** + * The name of the customer. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Information about the product. + */ + @JsonProperty(value = "properties.enabledAzureSKUs") + private List enabledAzureSKUs; + + /** + * The resellers which are allowed to provide service to this customer. + */ + @JsonProperty(value = "properties.resellers") + private List resellers; + + /** + * Get the name of the customer. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the customer. + * + * @param displayName the displayName value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get information about the product. + * + * @return the enabledAzureSKUs value + */ + public List enabledAzureSKUs() { + return this.enabledAzureSKUs; + } + + /** + * Set information about the product. + * + * @param enabledAzureSKUs the enabledAzureSKUs value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withEnabledAzureSKUs(List enabledAzureSKUs) { + this.enabledAzureSKUs = enabledAzureSKUs; + return this; + } + + /** + * Get the resellers which are allowed to provide service to this customer. + * + * @return the resellers value + */ + public List resellers() { + return this.resellers; + } + + /** + * Set the resellers which are allowed to provide service to this customer. + * + * @param resellers the resellers value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withResellers(List resellers) { + this.resellers = resellers; + return this; + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerListResultImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerListResultImpl.java new file mode 100644 index 000000000000..952e1143ef02 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerListResultImpl.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_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.CustomerListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class CustomerListResultImpl extends WrapperImpl implements CustomerListResult { + private final BillingManager manager; + CustomerListResultImpl(CustomerListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerListResultInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerListResultInner.java new file mode 100644 index 000000000000..1f25ae5982ad --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerListResultInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of listing customers. + */ +public class CustomerListResultInner { + /** + * The list of customers. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of customers. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersImpl.java new file mode 100644 index 000000000000..b156c65476a7 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersImpl.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Customers; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Customer; + +class CustomersImpl extends WrapperImpl implements Customers { + private final BillingManager manager; + + CustomersImpl(BillingManager manager) { + super(manager.inner().customers()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private CustomerImpl wrapModel(CustomerInner inner) { + return new CustomerImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountNameAsync(final String billingAccountName) { + CustomersInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Customer call(CustomerInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String customerName) { + CustomersInner client = this.inner(); + return client.getAsync(billingAccountName, customerName) + .map(new Func1() { + @Override + public Customer call(CustomerInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersInner.java new file mode 100644 index 000000000000..34837c6cce57 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersInner.java @@ -0,0 +1,578 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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_11_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_11_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 Customers. + */ +public class CustomersInner { + /** The Retrofit service to perform REST calls. */ + private CustomersService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of CustomersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CustomersInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(CustomersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Customers to be + * used by Retrofit to perform actually REST calls. + */ + interface CustomersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Customers listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Customers get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @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_11_01_preview.Customers listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName 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; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), filter, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter using hasPermission('{permissionId}') to only return customers for which the caller has the specified permission. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName, final String filter, final String skiptoken) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, filter, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter using hasPermission('{permissionId}') to only return customers for which the caller has the specified permission. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String filter, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, filter, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter using hasPermission('{permissionId}') to only return customers for which the caller has the specified permission. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String filter, final String skiptoken) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, filter, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter using hasPermission('{permissionId}') to only return customers for which the caller has the specified permission. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String filter, final String skiptoken) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, filter, skiptoken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param filter May be used to filter using hasPermission('{permissionId}') to only return customers for which the caller has the specified permission. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String filter, final String skiptoken) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName 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.listByBillingAccountName(billingAccountName, this.client.apiVersion(), filter, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameDelegate(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); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CustomerInner object if successful. + */ + public CustomerInner get(String billingAccountName, String customerName) { + return getWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable getAsync(String billingAccountName, String customerName) { + return getWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, CustomerInner>() { + @Override + public CustomerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.get(billingAccountName, customerName, this.client.apiVersion(), expand, 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); + } + } + }); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param expand May be used to expand enabledAzureSkus, resellers. + * @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 CustomerInner object if successful. + */ + public CustomerInner get(String billingAccountName, String customerName, String expand) { + return getWithServiceResponseAsync(billingAccountName, customerName, expand).toBlocking().single().body(); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param expand May be used to expand enabledAzureSkus, resellers. + * @param serviceCallback 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 billingAccountName, String customerName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, customerName, expand), serviceCallback); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param expand May be used to expand enabledAzureSkus, resellers. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable getAsync(String billingAccountName, String customerName, String expand) { + return getWithServiceResponseAsync(billingAccountName, customerName, expand).map(new Func1, CustomerInner>() { + @Override + public CustomerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param expand May be used to expand enabledAzureSkus, resellers. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String customerName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName 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(billingAccountName, customerName, this.client.apiVersion(), expand, 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 all customers which the current user can work with on-behalf of a partner. + * + * @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<CustomerInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @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> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @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<CustomerInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @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<CustomerInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(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.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(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/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsImpl.java index 65c94d44eccf..b2a559b8be99 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsImpl.java @@ -13,7 +13,7 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.Departments; import rx.Observable; import rx.functions.Func1; -import com.microsoft.azure.management.billing.v2018_11_01_preview.DepartmentListResult; +import com.microsoft.azure.Page; import com.microsoft.azure.management.billing.v2018_11_01_preview.Department; class DepartmentsImpl extends WrapperImpl implements Departments { @@ -33,13 +33,19 @@ private DepartmentImpl wrapModel(DepartmentInner inner) { } @Override - public Observable listByBillingAccountNameAsync(String billingAccountName) { + public Observable listByBillingAccountNameAsync(final String billingAccountName) { DepartmentsInner client = this.inner(); return client.listByBillingAccountNameAsync(billingAccountName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public DepartmentListResult call(DepartmentListResultInner inner) { - return new DepartmentListResultImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Department call(DepartmentInner inner) { + return wrapModel(inner); } }); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsInner.java index a95cb9677e36..28d1c8ecd601 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsInner.java @@ -10,17 +10,23 @@ 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_11_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; @@ -59,57 +65,97 @@ interface DepartmentsService { @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}") Observable> get(@Path("billingAccountName") String billingAccountName, @Path("departmentName") String departmentName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @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_11_01_preview.Departments listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** - * Lists all departments for a user which he has access to. + * Lists all departments for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the DepartmentListResultInner object if successful. + * @return the PagedList<DepartmentInner> object if successful. */ - public DepartmentListResultInner listByBillingAccountName(String billingAccountName) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Lists all departments for a user which he has access to. + * Lists all departments for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Lists all departments for a user which he has access to. + * Lists all departments for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DepartmentListResultInner object + * @return the observable to the PagedList<DepartmentInner> object */ - public Observable listByBillingAccountNameAsync(String billingAccountName) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, DepartmentListResultInner>() { - @Override - public DepartmentListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all departments for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DepartmentInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** - * Lists all departments for a user which he has access to. + * Lists all departments for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DepartmentListResultInner object + * @return the PagedList<DepartmentInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -119,12 +165,12 @@ public Observable> listByBillingAccou final String expand = null; final String filter = null; return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -133,62 +179,100 @@ public Observable> call(Response listByBillingAccountName(final String billingAccountName, final String expand, final String filter) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Lists all departments for a user which he has access to. + * Lists all departments for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the enrollmentAccounts. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, String expand, String filter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter), serviceCallback); + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Lists all departments for a user which he has access to. + * Lists all departments for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the enrollmentAccounts. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DepartmentListResultInner object + * @return the observable to the PagedList<DepartmentInner> object */ - public Observable listByBillingAccountNameAsync(String billingAccountName, String expand, String filter) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).map(new Func1, DepartmentListResultInner>() { - @Override - public DepartmentListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Lists all departments for a user which he has access to. + * Lists all departments for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the enrollmentAccounts. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DepartmentListResultInner object + * @return the observable to the PagedList<DepartmentInner> object */ - public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand, String filter) { + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String expand, final String filter) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all departments for which a user has access. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param expand May be used to expand the enrollmentAccounts. + ServiceResponse> * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DepartmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String expand, final String filter) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -196,12 +280,12 @@ public Observable> listByBillingAccou throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -209,9 +293,9 @@ public Observable> call(Response listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByBillingAccountNameDelegate(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); } @@ -219,7 +303,7 @@ private ServiceResponse listByBillingAccountNameDeleg /** * Get the department by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param departmentName Department Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -233,7 +317,7 @@ public DepartmentInner get(String billingAccountName, String departmentName) { /** * Get the department by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param departmentName Department Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -246,7 +330,7 @@ public ServiceFuture getAsync(String billingAccountName, String /** * Get the department by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param departmentName Department Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DepartmentInner object @@ -263,7 +347,7 @@ public DepartmentInner call(ServiceResponse response) { /** * Get the department by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param departmentName Department Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DepartmentInner object @@ -297,7 +381,7 @@ public Observable> call(Response /** * Get the department by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param departmentName Department Id. * @param expand May be used to expand the enrollmentAccounts. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). @@ -313,7 +397,7 @@ public DepartmentInner get(String billingAccountName, String departmentName, Str /** * Get the department by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param departmentName Department Id. * @param expand May be used to expand the enrollmentAccounts. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). @@ -328,7 +412,7 @@ public ServiceFuture getAsync(String billingAccountName, String /** * Get the department by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param departmentName Department Id. * @param expand May be used to expand the enrollmentAccounts. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). @@ -347,7 +431,7 @@ public DepartmentInner call(ServiceResponse response) { /** * Get the department by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param departmentName Department Id. * @param expand May be used to expand the enrollmentAccounts. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). @@ -385,4 +469,115 @@ private ServiceResponse getDelegate(Response resp .build(response); } + /** + * Lists all departments for which a user has access. + * + * @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<DepartmentInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all departments for which a user has access. + * + * @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> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all departments for which a user has access. + * + * @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<DepartmentInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all departments for which a user has access. + * + * @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<DepartmentInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all departments for which a user has access. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DepartmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(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.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(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/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsImpl.java index acb50bb0905d..89628acfa3aa 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsImpl.java @@ -13,7 +13,7 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccounts; import rx.Observable; import rx.functions.Func1; -import com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccountListResult; +import com.microsoft.azure.Page; import com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccount; class EnrollmentAccountsImpl extends WrapperImpl implements EnrollmentAccounts { @@ -33,13 +33,19 @@ private EnrollmentAccountImpl wrapModel(EnrollmentAccountInner inner) { } @Override - public Observable listByBillingAccountNameAsync(String billingAccountName) { + public Observable listByBillingAccountNameAsync(final String billingAccountName) { EnrollmentAccountsInner client = this.inner(); return client.listByBillingAccountNameAsync(billingAccountName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public EnrollmentAccountListResult call(EnrollmentAccountListResultInner inner) { - return new EnrollmentAccountListResultImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public EnrollmentAccount call(EnrollmentAccountInner inner) { + return wrapModel(inner); } }); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsInner.java index beda2f6272b5..c230b01b5a69 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsInner.java @@ -10,17 +10,23 @@ 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_11_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; @@ -59,57 +65,97 @@ interface EnrollmentAccountsService { @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}") Observable> getByEnrollmentAccountId(@Path("billingAccountName") String billingAccountName, @Path("enrollmentAccountName") String enrollmentAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @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_11_01_preview.EnrollmentAccounts listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** - * Lists all Enrollment Accounts for a user which he has access to. + * Lists all Enrollment Accounts for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the EnrollmentAccountListResultInner object if successful. + * @return the PagedList<EnrollmentAccountInner> object if successful. */ - public EnrollmentAccountListResultInner listByBillingAccountName(String billingAccountName) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Lists all Enrollment Accounts for a user which he has access to. + * Lists all Enrollment Accounts for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Lists all Enrollment Accounts for a user which he has access to. + * Lists all Enrollment Accounts for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the EnrollmentAccountListResultInner object + * @return the observable to the PagedList<EnrollmentAccountInner> object */ - public Observable listByBillingAccountNameAsync(String billingAccountName) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, EnrollmentAccountListResultInner>() { - @Override - public EnrollmentAccountListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EnrollmentAccountInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** - * Lists all Enrollment Accounts for a user which he has access to. + * Lists all Enrollment Accounts for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the EnrollmentAccountListResultInner object + * @return the PagedList<EnrollmentAccountInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -119,12 +165,12 @@ public Observable> listByBilli final String expand = null; final String filter = null; return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -133,62 +179,100 @@ public Observable> call(Respon } /** - * Lists all Enrollment Accounts for a user which he has access to. + * Lists all Enrollment Accounts for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the department. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @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 EnrollmentAccountListResultInner object if successful. + * @return the PagedList<EnrollmentAccountInner> object if successful. */ - public EnrollmentAccountListResultInner listByBillingAccountName(String billingAccountName, String expand, String filter) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).toBlocking().single().body(); + public PagedList listByBillingAccountName(final String billingAccountName, final String expand, final String filter) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Lists all Enrollment Accounts for a user which he has access to. + * Lists all Enrollment Accounts for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the department. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, String expand, String filter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter), serviceCallback); + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Lists all Enrollment Accounts for a user which he has access to. + * Lists all Enrollment Accounts for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the department. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the EnrollmentAccountListResultInner object + * @return the observable to the PagedList<EnrollmentAccountInner> object */ - public Observable listByBillingAccountNameAsync(String billingAccountName, String expand, String filter) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).map(new Func1, EnrollmentAccountListResultInner>() { - @Override - public EnrollmentAccountListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Lists all Enrollment Accounts for a user which he has access to. + * Lists all Enrollment Accounts for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the department. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the EnrollmentAccountListResultInner object + * @return the observable to the PagedList<EnrollmentAccountInner> object */ - public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand, String filter) { + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String expand, final String filter) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param expand May be used to expand the department. + ServiceResponse> * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EnrollmentAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String expand, final String filter) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -196,12 +280,12 @@ public Observable> listByBilli throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -209,9 +293,9 @@ public Observable> call(Respon }); } - private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByBillingAccountNameDelegate(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); } @@ -219,7 +303,7 @@ private ServiceResponse listByBillingAccountNa /** * Get the enrollment account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param enrollmentAccountName Enrollment Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -233,7 +317,7 @@ public EnrollmentAccountInner getByEnrollmentAccountId(String billingAccountName /** * Get the enrollment account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param enrollmentAccountName Enrollment Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -246,7 +330,7 @@ public ServiceFuture getByEnrollmentAccountIdAsync(Strin /** * Get the enrollment account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param enrollmentAccountName Enrollment Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the EnrollmentAccountInner object @@ -263,7 +347,7 @@ public EnrollmentAccountInner call(ServiceResponse respo /** * Get the enrollment account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param enrollmentAccountName Enrollment Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the EnrollmentAccountInner object @@ -297,7 +381,7 @@ public Observable> call(Response getByEnrollmentAccountIdAsync(Strin /** * Get the enrollment account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param enrollmentAccountName Enrollment Account Id. * @param expand May be used to expand the Department. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). @@ -347,7 +431,7 @@ public EnrollmentAccountInner call(ServiceResponse respo /** * Get the enrollment account by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param enrollmentAccountName Enrollment Account Id. * @param expand May be used to expand the Department. * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). @@ -385,4 +469,115 @@ private ServiceResponse getByEnrollmentAccountIdDelegate .build(response); } + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @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 listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @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> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @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> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @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>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + 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>> listByBillingAccountNameNextSinglePageAsync(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.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(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/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsImpl.java index 3d0c028aee6a..483b44ac4133 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsImpl.java @@ -14,6 +14,7 @@ import rx.Observable; import rx.functions.Func1; import rx.Completable; +import com.microsoft.azure.Page; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionListResult; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSection; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionCreationRequest; @@ -47,13 +48,19 @@ public InvoiceSectionListResult call(InvoiceSectionListResultInner inner) { } @Override - public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + public Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName) { InvoiceSectionsInner client = this.inner(); return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public InvoiceSectionListResult call(InvoiceSectionListResultInner inner) { - return new InvoiceSectionListResultImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InvoiceSection call(InvoiceSectionInner inner) { + return new InvoiceSectionImpl(inner, manager()); } }); } @@ -89,13 +96,19 @@ public InvoiceSection call(InvoiceSectionInner inner) { } @Override - public Observable listByCreateSubscriptionPermissionAsync(String billingAccountName) { + public Observable listByCreateSubscriptionPermissionAsync(final String billingAccountName) { InvoiceSectionsInner client = this.inner(); return client.listByCreateSubscriptionPermissionAsync(billingAccountName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public InvoiceSectionListResult call(InvoiceSectionListResultInner inner) { - return new InvoiceSectionListResultImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InvoiceSection call(InvoiceSectionInner inner) { + return new InvoiceSectionImpl(inner, manager()); } }); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsInner.java index 62f20dea01c8..2f2981e25114 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsInner.java @@ -10,16 +10,21 @@ 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_11_01_preview.ErrorResponseException; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionCreationRequest; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionsCreateHeaders; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionsUpdateHeaders; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseWithHeaders; import com.microsoft.rest.Validator; import java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; @@ -29,6 +34,7 @@ import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -95,12 +101,20 @@ interface InvoiceSectionsService { @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/elevate") Observable> elevateToBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @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_11_01_preview.InvoiceSections listByBillingProfileNameNext" }) + @GET + Observable> listByBillingProfileNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections listByCreateSubscriptionPermissionNext" }) + @GET + Observable> listByCreateSubscriptionPermissionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** - * Lists all invoice sections for a user which he has access to. + * Lists all invoice sections for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -111,9 +125,9 @@ public InvoiceSectionListResultInner listByBillingAccountName(String billingAcco } /** - * Lists all invoice sections for a user which he has access to. + * Lists all invoice sections for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -123,9 +137,9 @@ public ServiceFuture listByBillingAccountNameAsyn } /** - * Lists all invoice sections for a user which he has access to. + * Lists all invoice sections for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the InvoiceSectionListResultInner object */ @@ -139,9 +153,9 @@ public InvoiceSectionListResultInner call(ServiceResponse> call(Response< } /** - * Lists all invoice sections for a user which he has access to. + * Lists all invoice sections for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the billingProfiles. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -182,9 +196,9 @@ public InvoiceSectionListResultInner listByBillingAccountName(String billingAcco } /** - * Lists all invoice sections for a user which he has access to. + * Lists all invoice sections for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the billingProfiles. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -195,9 +209,9 @@ public ServiceFuture listByBillingAccountNameAsyn } /** - * Lists all invoice sections for a user which he has access to. + * Lists all invoice sections for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the billingProfiles. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the InvoiceSectionListResultInner object @@ -212,9 +226,9 @@ public InvoiceSectionListResultInner call(ServiceResponse listByBillingAccountNameD /** * The operation to create a InvoiceSection. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the Create InvoiceSection operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -264,7 +278,7 @@ public InvoiceSectionInner create(String billingAccountName, InvoiceSectionCreat /** * The operation to create a InvoiceSection. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the Create InvoiceSection operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -277,7 +291,7 @@ public ServiceFuture createAsync(String billingAccountName, /** * The operation to create a InvoiceSection. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the Create InvoiceSection operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request @@ -294,7 +308,7 @@ public InvoiceSectionInner call(ServiceResponseWithHeaders beginCreateAsync(String billingAccount /** * The operation to create a InvoiceSection. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param parameters Parameters supplied to the Create InvoiceSection operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the InvoiceSectionInner object @@ -361,7 +375,7 @@ public InvoiceSectionInner call(ServiceResponseWithHeaders listByBillingProfileName(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Lists all invoice sections under a billing profile for a user which he has access to. + * Lists all invoice sections under a billing profile for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + public ServiceFuture> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Lists all invoice sections under a billing profile for a user which he has access to. + * Lists all invoice sections under a billing profile for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InvoiceSectionListResultInner object + * @return the observable to the PagedList<InvoiceSectionInner> object */ - public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { - return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, InvoiceSectionListResultInner>() { - @Override - public InvoiceSectionListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Lists all invoice sections under a billing profile for a user which he has access to. + * Lists all invoice sections under a billing profile for which a user has access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InvoiceSectionListResultInner object + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable>> listByBillingProfileNameWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName) + .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(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + public Observable>> listByBillingProfileNameSinglePageAsync(final String billingAccountName, final String billingProfileName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -462,12 +513,12 @@ public Observable> listByBillingP throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingProfileNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingProfileNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -475,9 +526,9 @@ public Observable> call(Response< }); } - private ServiceResponse listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByBillingProfileNameDelegate(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); } @@ -485,52 +536,88 @@ private ServiceResponse listByBillingProfileNameD /** * Lists all invoiceSections with create subscription permission for a user. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the InvoiceSectionListResultInner object if successful. + * @return the PagedList<InvoiceSectionInner> object if successful. */ - public InvoiceSectionListResultInner listByCreateSubscriptionPermission(String billingAccountName) { - return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + public PagedList listByCreateSubscriptionPermission(final String billingAccountName) { + ServiceResponse> response = listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists all invoiceSections with create subscription permission for a user. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByCreateSubscriptionPermissionAsync(String billingAccountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName), serviceCallback); + public ServiceFuture> listByCreateSubscriptionPermissionAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists all invoiceSections with create subscription permission for a user. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InvoiceSectionListResultInner object + * @return the observable to the PagedList<InvoiceSectionInner> object */ - public Observable listByCreateSubscriptionPermissionAsync(String billingAccountName) { - return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName).map(new Func1, InvoiceSectionListResultInner>() { - @Override - public InvoiceSectionListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByCreateSubscriptionPermissionAsync(final String billingAccountName) { + return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Lists all invoiceSections with create subscription permission for a user. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InvoiceSectionListResultInner object + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable>> listByCreateSubscriptionPermissionWithServiceResponseAsync(final String billingAccountName) { + return listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName) + .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(listByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByCreateSubscriptionPermissionWithServiceResponseAsync(String billingAccountName) { + public Observable>> listByCreateSubscriptionPermissionSinglePageAsync(final String billingAccountName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -539,12 +626,12 @@ public Observable> listByCreateSu } final String expand = null; return service.listByCreateSubscriptionPermission(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByCreateSubscriptionPermissionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByCreateSubscriptionPermissionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -555,56 +642,93 @@ public Observable> call(Response< /** * Lists all invoiceSections with create subscription permission for a user. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the billingProfiles. * @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 InvoiceSectionListResultInner object if successful. + * @return the PagedList<InvoiceSectionInner> object if successful. */ - public InvoiceSectionListResultInner listByCreateSubscriptionPermission(String billingAccountName, String expand) { - return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName, expand).toBlocking().single().body(); + public PagedList listByCreateSubscriptionPermission(final String billingAccountName, final String expand) { + ServiceResponse> response = listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists all invoiceSections with create subscription permission for a user. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the billingProfiles. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByCreateSubscriptionPermissionAsync(String billingAccountName, String expand, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName, expand), serviceCallback); + public ServiceFuture> listByCreateSubscriptionPermissionAsync(final String billingAccountName, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists all invoiceSections with create subscription permission for a user. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the billingProfiles. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InvoiceSectionListResultInner object + * @return the observable to the PagedList<InvoiceSectionInner> object */ - public Observable listByCreateSubscriptionPermissionAsync(String billingAccountName, String expand) { - return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName, expand).map(new Func1, InvoiceSectionListResultInner>() { - @Override - public InvoiceSectionListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByCreateSubscriptionPermissionAsync(final String billingAccountName, final String expand) { + return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Lists all invoiceSections with create subscription permission for a user. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param expand May be used to expand the billingProfiles. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InvoiceSectionListResultInner object + * @return the observable to the PagedList<InvoiceSectionInner> object */ - public Observable> listByCreateSubscriptionPermissionWithServiceResponseAsync(String billingAccountName, String expand) { + public Observable>> listByCreateSubscriptionPermissionWithServiceResponseAsync(final String billingAccountName, final String expand) { + return listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName, expand) + .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(listByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param expand May be used to expand the billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCreateSubscriptionPermissionSinglePageAsync(final String billingAccountName, final String expand) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -612,12 +736,12 @@ public Observable> listByCreateSu throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listByCreateSubscriptionPermission(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByCreateSubscriptionPermissionDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByCreateSubscriptionPermissionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -625,9 +749,9 @@ public Observable> call(Response< }); } - private ServiceResponse listByCreateSubscriptionPermissionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByCreateSubscriptionPermissionDelegate(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); } @@ -635,7 +759,7 @@ private ServiceResponse listByCreateSubscriptionP /** * Get the InvoiceSection by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -649,7 +773,7 @@ public InvoiceSectionInner get(String billingAccountName, String invoiceSectionN /** * Get the InvoiceSection by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -662,7 +786,7 @@ public ServiceFuture getAsync(String billingAccountName, St /** * Get the InvoiceSection by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the InvoiceSectionInner object @@ -679,7 +803,7 @@ public InvoiceSectionInner call(ServiceResponse response) { /** * Get the InvoiceSection by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the InvoiceSectionInner object @@ -712,7 +836,7 @@ public Observable> call(Response getAsync(String billingAccountName, St /** * Get the InvoiceSection by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param expand May be used to expand the billingProfiles. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -759,7 +883,7 @@ public InvoiceSectionInner call(ServiceResponse response) { /** * Get the InvoiceSection by id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param expand May be used to expand the billingProfiles. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -799,7 +923,7 @@ private ServiceResponse getDelegate(Response /** * The operation to update a InvoiceSection. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param parameters Parameters supplied to the Create InvoiceSection operation. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -814,7 +938,7 @@ public InvoiceSectionInner update(String billingAccountName, String invoiceSecti /** * The operation to update a InvoiceSection. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param parameters Parameters supplied to the Create InvoiceSection operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -828,7 +952,7 @@ public ServiceFuture updateAsync(String billingAccountName, /** * The operation to update a InvoiceSection. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param parameters Parameters supplied to the Create InvoiceSection operation. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -846,7 +970,7 @@ public InvoiceSectionInner call(ServiceResponseWithHeaders beginUpdateAsync(String billingAccount /** * The operation to update a InvoiceSection. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param parameters Parameters supplied to the Create InvoiceSection operation. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -920,7 +1044,7 @@ public InvoiceSectionInner call(ServiceResponseWithHeaders elevateToBillingProfileAsync(String billingAccountNam /** * Elevates the caller's access to match their billing profile access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. @@ -1008,7 +1132,7 @@ public Void call(ServiceResponse response) { /** * Elevates the caller's access to match their billing profile access. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. @@ -1041,4 +1165,226 @@ private ServiceResponse elevateToBillingProfileDelegate(Response listByBillingProfileNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @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> listByBillingProfileNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @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<InvoiceSectionInner> object + */ + public Observable> listByBillingProfileNameNextAsync(final String nextPageLink) { + return listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @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<InvoiceSectionInner> object + */ + public Observable>> listByBillingProfileNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(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(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameNextSinglePageAsync(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.listByBillingProfileNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @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<InvoiceSectionInner> object if successful. + */ + public PagedList listByCreateSubscriptionPermissionNext(final String nextPageLink) { + ServiceResponse> response = listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @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> listByCreateSubscriptionPermissionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @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<InvoiceSectionInner> object + */ + public Observable> listByCreateSubscriptionPermissionNextAsync(final String nextPageLink) { + return listByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @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<InvoiceSectionInner> object + */ + public Observable>> listByCreateSubscriptionPermissionNextWithServiceResponseAsync(final String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(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(listByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCreateSubscriptionPermissionNextSinglePageAsync(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.listByCreateSubscriptionPermissionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCreateSubscriptionPermissionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCreateSubscriptionPermissionNextDelegate(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/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryImpl.java index 688680a42a21..267283ce7c85 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryImpl.java @@ -10,6 +10,7 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSummary; import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; import java.util.List; import com.microsoft.azure.management.billing.v2018_11_01_preview.DownloadProperties; @@ -18,7 +19,8 @@ class InvoiceSummaryImpl extends WrapperImpl implements InvoiceSummary { private final BillingManager manager; - InvoiceSummaryImpl(InvoiceSummaryInner inner, BillingManager manager) { + + InvoiceSummaryImpl(InvoiceSummaryInner inner, BillingManager manager) { super(inner); this.manager = manager; } @@ -28,6 +30,8 @@ public BillingManager manager() { return this.manager; } + + @Override public Amount amountDue() { return this.inner().amountDue(); diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesImpl.java index ae569b98dd7d..f738d5482ad0 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesImpl.java @@ -4,16 +4,16 @@ * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * abc + * */ package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.billing.v2018_11_01_preview.Invoices; -import rx.functions.Func1; import rx.Observable; -import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceListResult; +import rx.functions.Func1; +import com.microsoft.azure.Page; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSummary; class InvoicesImpl extends WrapperImpl implements Invoices { @@ -28,38 +28,54 @@ public BillingManager manager() { return this.manager; } + private InvoiceSummaryImpl wrapModel(InvoiceSummaryInner inner) { + return new InvoiceSummaryImpl(inner, manager()); + } + @Override - public Observable listByBillingAccountNameAsync(String billingAccountName, String periodStartDate, String periodEndDate) { + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { InvoicesInner client = this.inner(); - return client.listByBillingAccountNameAsync(billingAccountName, periodStartDate, periodEndDate) - .map(new Func1() { + return client.listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public InvoiceListResult call(InvoiceListResultInner inner) { - return new InvoiceListResultImpl(inner, manager()); + public InvoiceSummary call(InvoiceSummaryInner inner) { + return new InvoiceSummaryImpl(inner, manager()); } }); } @Override - public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceName) { InvoicesInner client = this.inner(); - return client.listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) - .map(new Func1() { + return client.getAsync(billingAccountName, billingProfileName, invoiceName) + .map(new Func1() { @Override - public InvoiceListResult call(InvoiceListResultInner inner) { - return new InvoiceListResultImpl(inner, manager()); + public InvoiceSummary call(InvoiceSummaryInner inner) { + return new InvoiceSummaryImpl(inner, manager()); } }); } @Override - public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceName) { + public Observable listByBillingAccountNameAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { InvoicesInner client = this.inner(); - return client.getAsync(billingAccountName, billingProfileName, invoiceName) + return client.listByBillingAccountNameAsync(billingAccountName, periodStartDate, periodEndDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) .map(new Func1() { @Override public InvoiceSummary call(InvoiceSummaryInner inner) { - return new InvoiceSummaryImpl(inner, manager()); + return wrapModel(inner); } }); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesInner.java index fc7dfa059b76..3496d50557cf 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesInner.java @@ -10,17 +10,23 @@ 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_11_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; @@ -63,65 +69,111 @@ interface InvoicesService { @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}") Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceName") String invoiceName, @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_11_01_preview.Invoices listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Invoices listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** * List of invoices for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param periodStartDate Invoice period start date. * @param periodEndDate Invoice period end date. * @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 InvoiceListResultInner object if successful. + * @return the PagedList<InvoiceSummaryInner> object if successful. */ - public InvoiceListResultInner listByBillingAccountName(String billingAccountName, String periodStartDate, String periodEndDate) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate).toBlocking().single().body(); + public PagedList listByBillingAccountName(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, periodStartDate, periodEndDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * List of invoices for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param periodStartDate Invoice period start date. * @param periodEndDate Invoice period end date. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, String periodStartDate, String periodEndDate, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate), serviceCallback); + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, periodStartDate, periodEndDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * List of invoices for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param periodStartDate Invoice period start date. * @param periodEndDate Invoice period end date. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InvoiceListResultInner object + * @return the observable to the PagedList<InvoiceSummaryInner> object */ - public Observable listByBillingAccountNameAsync(String billingAccountName, String periodStartDate, String periodEndDate) { - return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate).map(new Func1, InvoiceListResultInner>() { - @Override - public InvoiceListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * List of invoices for a billing account. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param periodStartDate Invoice period start date. * @param periodEndDate Invoice period end date. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InvoiceListResultInner object + * @return the observable to the PagedList<InvoiceSummaryInner> object */ - public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String periodStartDate, String periodEndDate) { + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, periodStartDate, periodEndDate) + .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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List of invoices for a billing account. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param periodStartDate Invoice period start date. + ServiceResponse> * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -135,12 +187,12 @@ public Observable> listByBillingAccountN throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); } return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), periodStartDate, periodEndDate, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -148,9 +200,9 @@ public Observable> call(Response listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByBillingAccountNameDelegate(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); } @@ -158,23 +210,29 @@ private ServiceResponse listByBillingAccountNameDelegate /** * List of invoices for a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param periodStartDate Invoice period start date. * @param periodEndDate Invoice period end date. * @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 InvoiceListResultInner object if successful. + * @return the PagedList<InvoiceSummaryInner> object if successful. */ - public InvoiceListResultInner listByBillingProfile(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { - return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).toBlocking().single().body(); + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * List of invoices for a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param periodStartDate Invoice period start date. * @param periodEndDate Invoice period end date. @@ -182,40 +240,73 @@ public InvoiceListResultInner listByBillingProfile(String billingAccountName, St * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate), serviceCallback); + public ServiceFuture> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * List of invoices for a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param periodStartDate Invoice period start date. * @param periodEndDate Invoice period end date. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InvoiceListResultInner object + * @return the observable to the PagedList<InvoiceSummaryInner> object */ - public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { - return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).map(new Func1, InvoiceListResultInner>() { - @Override - public InvoiceListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * List of invoices for a billing profile. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param periodStartDate Invoice period start date. * @param periodEndDate Invoice period end date. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the InvoiceListResultInner object + * @return the observable to the PagedList<InvoiceSummaryInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .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(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List of invoices for a billing profile. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param billingProfileName Billing Profile Id. + ServiceResponse> * @param periodStartDate Invoice period start date. + ServiceResponse> * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -232,12 +323,12 @@ public Observable> listByBillingProfileW throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); } return service.listByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), periodStartDate, periodEndDate, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingProfileDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -245,9 +336,9 @@ public Observable> call(Response listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByBillingProfileDelegate(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); } @@ -255,7 +346,7 @@ private ServiceResponse listByBillingProfileDelegate(Res /** * Get the invoice by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param invoiceName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -270,7 +361,7 @@ public InvoiceSummaryInner get(String billingAccountName, String billingProfileN /** * Get the invoice by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param invoiceName Invoice Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -284,7 +375,7 @@ public ServiceFuture getAsync(String billingAccountName, St /** * Get the invoice by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param invoiceName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -302,7 +393,7 @@ public InvoiceSummaryInner call(ServiceResponse response) { /** * Get the invoice by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param invoiceName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -342,4 +433,226 @@ private ServiceResponse getDelegate(Response .build(response); } + /** + * List of invoices for a billing account. + * + * @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<InvoiceSummaryInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List of invoices for a billing account. + * + * @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> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List of invoices for a billing account. + * + * @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<InvoiceSummaryInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List of invoices for a billing account. + * + * @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<InvoiceSummaryInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List of invoices for a billing account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(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.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List of invoices for a billing profile. + * + * @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<InvoiceSummaryInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List of invoices for a billing profile. + * + * @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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List of invoices for a billing profile. + * + * @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<InvoiceSummaryInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List of invoices for a billing profile. + * + * @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<InvoiceSummaryInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(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(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List of invoices for a billing profile. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(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.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(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/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsInner.java index 4348afb44904..c46663809ee0 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsInner.java @@ -77,7 +77,7 @@ interface PaymentMethodsService { /** * Lists the Payment Methods by billing account Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -96,7 +96,7 @@ public Page nextPage(String nextPageLink) { /** * Lists the Payment Methods by billing account Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -116,7 +116,7 @@ public Observable>> call(String nextPag /** * Lists the Payment Methods by billing account Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<PaymentMethodInner> object */ @@ -133,7 +133,7 @@ public Page call(ServiceResponse> r /** * Lists the Payment Methods by billing account Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<PaymentMethodInner> object */ @@ -154,7 +154,7 @@ public Observable>> call(ServiceRespons /** * Lists the Payment Methods by billing account Id. * - ServiceResponse> * @param billingAccountName billing Account Id. + ServiceResponse> * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<PaymentMethodInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -189,7 +189,7 @@ private ServiceResponse> listByBillingAccountNameDe /** * Lists the Payment Methods by billing profile Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -209,7 +209,7 @@ public Page nextPage(String nextPageLink) { /** * Lists the Payment Methods by billing profile Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -230,7 +230,7 @@ public Observable>> call(String nextPag /** * Lists the Payment Methods by billing profile Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<PaymentMethodInner> object @@ -248,7 +248,7 @@ public Page call(ServiceResponse> r /** * Lists the Payment Methods by billing profile Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<PaymentMethodInner> object @@ -270,7 +270,7 @@ public Observable>> call(ServiceRespons /** * Lists the Payment Methods by billing profile Id. * - ServiceResponse> * @param billingAccountName billing Account Id. + ServiceResponse> * @param billingAccountName Billing Account Id. ServiceResponse> * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<PaymentMethodInner> object wrapped in {@link ServiceResponse} if successful. diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesInner.java index 6fbe0b2f0bb3..4857dc1299e3 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesInner.java @@ -67,7 +67,7 @@ interface PoliciesService { /** * The policy for a given billing account name and billing profile name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -81,7 +81,7 @@ public PolicyInner getByBillingProfileName(String billingAccountName, String bil /** * The policy for a given billing account name and billing profile name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -94,7 +94,7 @@ public ServiceFuture getByBillingProfileNameAsync(String billingAcc /** * The policy for a given billing account name and billing profile name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PolicyInner object @@ -111,7 +111,7 @@ public PolicyInner call(ServiceResponse response) { /** * The policy for a given billing account name and billing profile name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PolicyInner object @@ -150,7 +150,7 @@ private ServiceResponse getByBillingProfileNameDelegate(Response updateAsync(String billingAccountName, String /** * The operation to update a policy. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param parameters Parameters supplied to the update policy operation. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -197,7 +197,7 @@ public PolicyInner call(ServiceResponse response) { /** * The operation to update a policy. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param parameters Parameters supplied to the update policy operation. * @throws IllegalArgumentException thrown if parameters fail the validation diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsImpl.java index 16ceaf35b635..828c68359e95 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsImpl.java @@ -14,7 +14,6 @@ import rx.Observable; import rx.functions.Func1; import com.microsoft.azure.Page; -import com.microsoft.azure.management.billing.v2018_11_01_preview.ProductsListResult; import com.microsoft.azure.management.billing.v2018_11_01_preview.ProductSummary; import com.microsoft.azure.management.billing.v2018_11_01_preview.ValidateProductTransferEligibilityResult; import com.microsoft.azure.management.billing.v2018_11_01_preview.UpdateAutoRenewOperationSummary; @@ -37,13 +36,19 @@ private ProductSummaryImpl wrapModel(ProductSummaryInner inner) { } @Override - public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + public Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName) { ProductsInner client = this.inner(); return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public ProductsListResult call(ProductsListResultInner inner) { - return new ProductsListResultImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ProductSummary call(ProductSummaryInner inner) { + return new ProductSummaryImpl(inner, manager()); } }); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsInner.java index a57194f634c9..6550b5445bb4 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsInner.java @@ -97,12 +97,16 @@ interface ProductsService { @GET Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Products listByInvoiceSectionNameNext" }) + @GET + Observable> listByInvoiceSectionNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** * Lists products by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @@ -121,7 +125,7 @@ public Page nextPage(String nextPageLink) { /** * Lists products by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object @@ -141,7 +145,7 @@ public Observable>> call(String nextPa /** * Lists products by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ProductSummaryInner> object */ @@ -158,7 +162,7 @@ public Page call(ServiceResponse> /** * Lists products by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ProductSummaryInner> object */ @@ -179,7 +183,7 @@ public Observable>> call(ServiceRespon /** * Lists products by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ProductSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ @@ -208,7 +212,7 @@ public Observable>> call(Response nextPage(String nextPageLink) { /** * Lists products by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -249,7 +253,7 @@ public Observable>> call(String nextPa /** * Lists products by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ProductSummaryInner> object @@ -267,7 +271,7 @@ public Page call(ServiceResponse> /** * Lists products by billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ProductSummaryInner> object @@ -289,7 +293,7 @@ public Observable>> call(ServiceRespon /** * Lists products by billing account name. * - ServiceResponse> * @param billingAccountName billing Account Id. + ServiceResponse> * @param billingAccountName Billing Account Id. ServiceResponse> * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ProductSummaryInner> object wrapped in {@link ServiceResponse} if successful. @@ -325,56 +329,93 @@ private ServiceResponse> listByBillingAccountNameD /** * Lists products by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ProductsListResultInner object if successful. + * @return the PagedList<ProductSummaryInner> object if successful. */ - public ProductsListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName) { - return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + public PagedList listByInvoiceSectionName(final String billingAccountName, final String invoiceSectionName) { + ServiceResponse> response = listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists products by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName), serviceCallback); + public ServiceFuture> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists products by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ProductsListResultInner object + * @return the observable to the PagedList<ProductSummaryInner> object */ - public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { - return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).map(new Func1, ProductsListResultInner>() { - @Override - public ProductsListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists products by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameWithServiceResponseAsync(final String billingAccountName, final String invoiceSectionName) { + return listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName) + .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(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** * Lists products by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ProductsListResultInner object + * @return the PagedList<ProductSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName) { + public Observable>> listByInvoiceSectionNameSinglePageAsync(final String billingAccountName, final String invoiceSectionName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -386,12 +427,12 @@ public Observable> listByInvoiceSection } final String filter = null; return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByInvoiceSectionNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -402,60 +443,98 @@ public Observable> call(Response listByInvoiceSectionName(final String billingAccountName, final String invoiceSectionName, final String filter) { + ServiceResponse> response = listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists products by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String filter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, filter), serviceCallback); + public ServiceFuture> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists products by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ProductsListResultInner object + * @return the observable to the PagedList<ProductSummaryInner> object */ - public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String filter) { - return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, filter).map(new Func1, ProductsListResultInner>() { - @Override - public ProductsListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String filter) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Lists products by invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ProductsListResultInner object + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameWithServiceResponseAsync(final String billingAccountName, final String invoiceSectionName, final String filter) { + return listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists products by invoice section name. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param invoiceSectionName InvoiceSection Id. + ServiceResponse> * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String filter) { + public Observable>> listByInvoiceSectionNameSinglePageAsync(final String billingAccountName, final String invoiceSectionName, final String filter) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -466,12 +545,12 @@ public Observable> listByInvoiceSection throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByInvoiceSectionNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -479,9 +558,9 @@ public Observable> call(Response listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByInvoiceSectionNameDelegate(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); } @@ -489,7 +568,7 @@ private ServiceResponse listByInvoiceSectionNameDelegat /** * Get a single product by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -504,7 +583,7 @@ public ProductSummaryInner get(String billingAccountName, String invoiceSectionN /** * Get a single product by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -518,7 +597,7 @@ public ServiceFuture getAsync(String billingAccountName, St /** * Get a single product by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -536,7 +615,7 @@ public ProductSummaryInner call(ServiceResponse response) { /** * Get a single product by name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -579,7 +658,7 @@ private ServiceResponse getDelegate(Response /** * The operation to transfer a Product to another invoice section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param parameters Parameters supplied to the Transfer Product operation. @@ -595,7 +674,7 @@ public ProductSummaryInner transfer(String billingAccountName, String invoiceSec /** * The operation to transfer a Product to another invoice section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param parameters Parameters supplied to the Transfer Product operation. @@ -610,7 +689,7 @@ public ServiceFuture transferAsync(String billingAccountNam /** * The operation to transfer a Product to another invoice section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param parameters Parameters supplied to the Transfer Product operation. @@ -629,7 +708,7 @@ public ProductSummaryInner call(ServiceResponseWithHeaders /** * Validates the transfer of products across invoice sections. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param parameters Parameters supplied to the Transfer Products operation. @@ -694,7 +773,7 @@ public ValidateProductTransferEligibilityResultInner validateTransfer(String bil /** * Validates the transfer of products across invoice sections. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param parameters Parameters supplied to the Transfer Products operation. @@ -709,7 +788,7 @@ public ServiceFuture validateTran /** * Validates the transfer of products across invoice sections. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param parameters Parameters supplied to the Transfer Products operation. @@ -728,7 +807,7 @@ public ValidateProductTransferEligibilityResultInner call(ServiceResponse validateT /** * Cancel auto renew for product by product id and billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param productName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws ErrorResponseException thrown if the request is rejected by server @@ -787,7 +866,7 @@ public UpdateAutoRenewOperationSummaryInner updateAutoRenewByBillingAccountName( /** * Cancel auto renew for product by product id and billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param productName Invoice Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -800,7 +879,7 @@ public ServiceFuture updateAutoRenewByBill /** * Cancel auto renew for product by product id and billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param productName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the UpdateAutoRenewOperationSummaryInner object @@ -817,7 +896,7 @@ public UpdateAutoRenewOperationSummaryInner call(ServiceResponse> call(Re /** * Cancel auto renew for product by product id and billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param productName Invoice Id. * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' * @throws IllegalArgumentException thrown if parameters fail the validation @@ -867,7 +946,7 @@ public UpdateAutoRenewOperationSummaryInner updateAutoRenewByBillingAccountName( /** * Cancel auto renew for product by product id and billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param productName Invoice Id. * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -881,7 +960,7 @@ public ServiceFuture updateAutoRenewByBill /** * Cancel auto renew for product by product id and billing account name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param productName Invoice Id. * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' * @throws IllegalArgumentException thrown if parameters fail the validation @@ -899,7 +978,7 @@ public UpdateAutoRenewOperationSummaryInner call(ServiceResponse updateAutoRenewByB /** * Cancel auto renew for product by product id and invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -956,7 +1035,7 @@ public UpdateAutoRenewOperationSummaryInner updateAutoRenewByInvoiceSectionName( /** * Cancel auto renew for product by product id and invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -970,7 +1049,7 @@ public ServiceFuture updateAutoRenewByInvo /** * Cancel auto renew for product by product id and invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -988,7 +1067,7 @@ public UpdateAutoRenewOperationSummaryInner call(ServiceResponse> call(Re /** * Cancel auto renew for product by product id and invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' @@ -1043,7 +1122,7 @@ public UpdateAutoRenewOperationSummaryInner updateAutoRenewByInvoiceSectionName( /** * Cancel auto renew for product by product id and invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' @@ -1058,7 +1137,7 @@ public ServiceFuture updateAutoRenewByInvo /** * Cancel auto renew for product by product id and invoice section name. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param productName Invoice Id. * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' @@ -1077,7 +1156,7 @@ public UpdateAutoRenewOperationSummaryInner call(ServiceResponse> listByBillingAccountNameN .build(response); } + /** + * Lists products by invoice section name. + * + * @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<ProductSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionNameNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists products by invoice section name. + * + * @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> listByInvoiceSectionNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists products by invoice section name. + * + * @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<ProductSummaryInner> object + */ + public Observable> listByInvoiceSectionNameNextAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists products by invoice section name. + * + * @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<ProductSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(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(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists products by invoice section name. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameNextSinglePageAsync(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.listByInvoiceSectionNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNameNextDelegate(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/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsImpl.java index d42c5f69c15d..3c76170d8461 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsImpl.java @@ -14,7 +14,6 @@ import rx.Observable; import rx.functions.Func1; import com.microsoft.azure.Page; -import com.microsoft.azure.management.billing.v2018_11_01_preview.TransactionsListResult; import com.microsoft.azure.management.billing.v2018_11_01_preview.TransactionsSummary; class TransactionsImpl extends WrapperImpl implements Transactions { @@ -34,25 +33,55 @@ private TransactionsSummaryImpl wrapModel(TransactionsSummaryInner inner) { } @Override - public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String startDate, String endDate) { + public Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate) { TransactionsInner client = this.inner(); return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName, startDate, endDate) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { @Override - public TransactionsListResult call(TransactionsListResultInner inner) { - return new TransactionsListResultImpl(inner, manager()); + public TransactionsSummary call(TransactionsSummaryInner inner) { + return new TransactionsSummaryImpl(inner, manager()); } }); } @Override - public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String startDate, String endDate) { + public Observable listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate) { + TransactionsInner client = this.inner(); + return client.listByCustomerNameAsync(billingAccountName, customerName, startDate, endDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TransactionsSummary call(TransactionsSummaryInner inner) { + return new TransactionsSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate) { TransactionsInner client = this.inner(); return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, startDate, endDate) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public TransactionsListResult call(TransactionsListResultInner inner) { - return new TransactionsListResultImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TransactionsSummary call(TransactionsSummaryInner inner) { + return new TransactionsSummaryImpl(inner, manager()); } }); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsInner.java index 626f39fef154..c55540dedded 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsInner.java @@ -15,7 +15,6 @@ import com.microsoft.azure.management.billing.v2018_11_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; @@ -65,6 +64,10 @@ interface TransactionsService { @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions") Observable> listByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Query("startDate") String startDate, @Query("endDate") String endDate, @Query("$filter") String filter, @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_11_01_preview.Transactions listByCustomerName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/transactions") + Observable> listByCustomerName(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Query("startDate") String startDate, @Query("endDate") String endDate, @Query("$filter") String filter, @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_11_01_preview.Transactions listByInvoiceSectionName" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transactions") Observable> listByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Query("startDate") String startDate, @Query("endDate") String endDate, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -73,12 +76,24 @@ interface TransactionsService { @GET Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByBillingProfileNameNext" }) + @GET + Observable> listByBillingProfileNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByCustomerNameNext" }) + @GET + Observable> listByCustomerNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByInvoiceSectionNameNext" }) + @GET + Observable> listByInvoiceSectionNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** * Lists the transactions by billing account name for given start and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param startDate Start date * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation @@ -99,7 +114,7 @@ public Page nextPage(String nextPageLink) { /** * Lists the transactions by billing account name for given start and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param startDate Start date * @param endDate End date * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -121,7 +136,7 @@ public Observable>> call(String n /** * Lists the transactions by billing account name for given start and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param startDate Start date * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation @@ -140,7 +155,7 @@ public Page call(ServiceResponse>> call(ServiceR /** * Lists the transactions by billing account name for given start and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param startDate Start date * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation @@ -200,7 +215,7 @@ public Observable>> call(Response /** * Lists the transactions by billing account name for given start and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param startDate Start date * @param endDate End date * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). @@ -222,7 +237,7 @@ public Page nextPage(String nextPageLink) { /** * Lists the transactions by billing account name for given start and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param startDate Start date * @param endDate End date * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). @@ -245,7 +260,7 @@ public Observable>> call(String n /** * Lists the transactions by billing account name for given start and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param startDate Start date * @param endDate End date * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). @@ -265,7 +280,7 @@ public Page call(ServiceResponse>> call(ServiceR /** * Lists the transactions by billing account name for given start and end date. * - ServiceResponse> * @param billingAccountName billing Account Id. + ServiceResponse> * @param billingAccountName Billing Account Id. ServiceResponse> * @param startDate Start date ServiceResponse> * @param endDate End date ServiceResponse> * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). @@ -333,23 +348,29 @@ private ServiceResponse> listByBillingAccount /** * Lists the transactions by billing profile name for given start date and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param startDate Start date * @param endDate End date * @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 TransactionsListResultInner object if successful. + * @return the PagedList<TransactionsSummaryInner> object if successful. */ - public TransactionsListResultInner listByBillingProfileName(String billingAccountName, String billingProfileName, String startDate, String endDate) { - return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate).toBlocking().single().body(); + public PagedList listByBillingProfileName(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate) { + ServiceResponse> response = listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists the transactions by billing profile name for given start date and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param startDate Start date * @param endDate End date @@ -357,40 +378,73 @@ public TransactionsListResultInner listByBillingProfileName(String billingAccoun * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String startDate, String endDate, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate), serviceCallback); + public ServiceFuture> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists the transactions by billing profile name for given start date and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param startDate Start date * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TransactionsListResultInner object + * @return the observable to the PagedList<TransactionsSummaryInner> object */ - public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String startDate, String endDate) { - return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate).map(new Func1, TransactionsListResultInner>() { - @Override - public TransactionsListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByBillingProfileNameWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate) { + return listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate) + .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(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** * Lists the transactions by billing profile name for given start date and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param startDate Start date * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TransactionsListResultInner object + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName, String startDate, String endDate) { + public Observable>> listByBillingProfileNameSinglePageAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -408,12 +462,12 @@ public Observable> listByBillingPro } final String filter = null; return service.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingProfileNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingProfileNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -424,7 +478,7 @@ public Observable> call(Response> call(Response listByBillingProfileName(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final String filter) { + ServiceResponse> response = listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists the transactions by billing profile name for given start date and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param startDate Start date * @param endDate End date @@ -450,42 +510,76 @@ public TransactionsListResultInner listByBillingProfileName(String billingAccoun * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String startDate, String endDate, String filter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate, filter), serviceCallback); + public ServiceFuture> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists the transactions by billing profile name for given start date and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param startDate Start date * @param endDate End date * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TransactionsListResultInner object + * @return the observable to the PagedList<TransactionsSummaryInner> object */ - public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String startDate, String endDate, String filter) { - return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate, filter).map(new Func1, TransactionsListResultInner>() { - @Override - public TransactionsListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final String filter) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Lists the transactions by billing profile name for given start date and end date. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param billingProfileName Billing Profile Id. * @param startDate Start date * @param endDate End date * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TransactionsListResultInner object + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByBillingProfileNameWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final String filter) { + return listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param billingProfileName Billing Profile Id. + ServiceResponse> * @param startDate Start date + ServiceResponse> * @param endDate End date + ServiceResponse> * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName, String startDate, String endDate, String filter) { + public Observable>> listByBillingProfileNameSinglePageAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final String filter) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -502,12 +596,12 @@ public Observable> listByBillingPro throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); } return service.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingProfileNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingProfileNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -515,9 +609,9 @@ public Observable> call(Response listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByBillingProfileNameDelegate(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); } @@ -525,69 +619,108 @@ private ServiceResponse listByBillingProfileNameDel /** * Lists the transactions by invoice section name for given start date and end date. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @param startDate Start date * @param endDate End date * @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 TransactionsListResultInner object if successful. + * @return the PagedList<TransactionsSummaryInner> object if successful. */ - public TransactionsListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String startDate, String endDate) { - return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate).toBlocking().single().body(); + public PagedList listByCustomerName(final String billingAccountName, final String customerName, final String startDate, final String endDate) { + ServiceResponse> response = listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists the transactions by invoice section name for given start date and end date. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @param startDate Start date * @param endDate End date * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String startDate, String endDate, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate), serviceCallback); + public ServiceFuture> listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists the transactions by invoice section name for given start date and end date. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @param startDate Start date * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TransactionsListResultInner object + * @return the observable to the PagedList<TransactionsSummaryInner> object */ - public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String startDate, String endDate) { - return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate).map(new Func1, TransactionsListResultInner>() { - @Override - public TransactionsListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate) { + return listByCustomerNameWithServiceResponseAsync(billingAccountName, customerName, startDate, endDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Lists the transactions by invoice section name for given start date and end date. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByCustomerNameWithServiceResponseAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate) { + return listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate) + .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(listByCustomerNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @param startDate Start date * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TransactionsListResultInner object + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String startDate, String endDate) { + public Observable>> listByCustomerNameSinglePageAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } - if (invoiceSectionName == null) { - throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); @@ -599,13 +732,13 @@ public Observable> listByInvoiceSec throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); } final String filter = null; - return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listByCustomerName(billingAccountName, customerName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByCustomerNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -616,25 +749,31 @@ public Observable> call(Response listByCustomerName(final String billingAccountName, final String customerName, final String startDate, final String endDate, final String filter) { + ServiceResponse> response = listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** * Lists the transactions by invoice section name for given start date and end date. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @param startDate Start date * @param endDate End date * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). @@ -642,47 +781,81 @@ public TransactionsListResultInner listByInvoiceSectionName(String billingAccoun * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String startDate, String endDate, String filter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter), serviceCallback); + public ServiceFuture> listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Lists the transactions by invoice section name for given start date and end date. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @param startDate Start date * @param endDate End date * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TransactionsListResultInner object + * @return the observable to the PagedList<TransactionsSummaryInner> object */ - public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String startDate, String endDate, String filter) { - return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter).map(new Func1, TransactionsListResultInner>() { - @Override - public TransactionsListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate, final String filter) { + return listByCustomerNameWithServiceResponseAsync(billingAccountName, customerName, startDate, endDate, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Lists the transactions by invoice section name for given start date and end date. * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. * @param startDate Start date * @param endDate End date * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the TransactionsListResultInner object + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByCustomerNameWithServiceResponseAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate, final String filter) { + return listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param customerName Customer Id. + ServiceResponse> * @param startDate Start date + ServiceResponse> * @param endDate End date + ServiceResponse> * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String startDate, String endDate, String filter) { + public Observable>> listByCustomerNameSinglePageAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate, final String filter) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } - if (invoiceSectionName == null) { - throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); @@ -693,13 +866,13 @@ public Observable> listByInvoiceSec if (endDate == null) { throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); } - return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.listByCustomerName(billingAccountName, customerName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByCustomerNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -707,62 +880,70 @@ public Observable> call(Response listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByCustomerNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(ErrorResponseException.class) .build(response); } /** - * Lists the transactions by billing account name for given start and end date. + * Lists the transactions by invoice section name for given start date and end date. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date * @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<TransactionsSummaryInner> object if successful. */ - public PagedList listByBillingAccountNameNext(final String nextPageLink) { - ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + public PagedList listByInvoiceSectionName(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate) { + ServiceResponse> response = listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate).toBlocking().single(); return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** - * Lists the transactions by billing account name for given start and end date. + * Lists the transactions by invoice section name for given start date and end date. * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + public ServiceFuture> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listByBillingAccountNameNextSinglePageAsync(nextPageLink), + listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate), new Func1>>>() { @Override public Observable>> call(String nextPageLink) { - return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** - * Lists the transactions by billing account name for given start and end date. + * Lists the transactions by invoice section name for given start date and end date. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<TransactionsSummaryInner> object */ - public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { - return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + public Observable> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate) .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -772,14 +953,17 @@ public Page call(ServiceResponse>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { - return listByBillingAccountNameNextSinglePageAsync(nextPageLink) + public Observable>> listByInvoiceSectionNameWithServiceResponseAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate) { + return listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate) .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { @@ -787,23 +971,283 @@ public Observable>> call(ServiceR if (nextPageLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); } }); } /** - * Lists the transactions by billing account name for given start and end date. + * Lists the transactions by invoice section name for given start date and end date. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listByBillingAccountNameNextSinglePageAsync(final String nextPageLink) { - if (nextPageLink == null) { - throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + public Observable>> listByInvoiceSectionNameSinglePageAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } - String nextUrl = String.format("%s", nextPageLink); + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (startDate == null) { + throw new IllegalArgumentException("Parameter startDate is required and cannot be null."); + } + if (endDate == null) { + throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); + } + final String filter = null; + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @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<TransactionsSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionName(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final String filter) { + ServiceResponse> response = listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final String filter) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameWithServiceResponseAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final String filter) { + return listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param invoiceSectionName InvoiceSection Id. + ServiceResponse> * @param startDate Start date + ServiceResponse> * @param endDate End date + ServiceResponse> * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameSinglePageAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (startDate == null) { + throw new IllegalArgumentException("Parameter startDate is required and cannot be null."); + } + if (endDate == null) { + throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); + } + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @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<TransactionsSummaryInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @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> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @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<TransactionsSummaryInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @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<TransactionsSummaryInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(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.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override @@ -825,4 +1269,337 @@ private ServiceResponse> listByBillingAccount .build(response); } + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @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<TransactionsSummaryInner> object if successful. + */ + public PagedList listByBillingProfileNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @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> listByBillingProfileNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @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<TransactionsSummaryInner> object + */ + public Observable> listByBillingProfileNameNextAsync(final String nextPageLink) { + return listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @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<TransactionsSummaryInner> object + */ + public Observable>> listByBillingProfileNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(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(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameNextSinglePageAsync(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.listByBillingProfileNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @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<TransactionsSummaryInner> object if successful. + */ + public PagedList listByCustomerNameNext(final String nextPageLink) { + ServiceResponse> response = listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @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> listByCustomerNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @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<TransactionsSummaryInner> object + */ + public Observable> listByCustomerNameNextAsync(final String nextPageLink) { + return listByCustomerNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @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<TransactionsSummaryInner> object + */ + public Observable>> listByCustomerNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(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(listByCustomerNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNameNextSinglePageAsync(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.listByCustomerNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @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<TransactionsSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionNameNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @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> listByInvoiceSectionNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @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<TransactionsSummaryInner> object + */ + public Observable> listByInvoiceSectionNameNextAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @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<TransactionsSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(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(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameNextSinglePageAsync(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.listByInvoiceSectionNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNameNextDelegate(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/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryImpl.java index 17e4947737d1..404c17ae6185 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryImpl.java @@ -41,6 +41,16 @@ public String billingProfileName() { return this.inner().billingProfileName(); } + @Override + public String customerDisplayName() { + return this.inner().customerDisplayName(); + } + + @Override + public String customerId() { + return this.inner().customerId(); + } + @Override public DateTime dateProperty() { return this.inner().dateProperty(); diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryInner.java index c45eeb94e5ac..e70edea0b91d 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryInner.java @@ -94,6 +94,18 @@ public class TransactionsSummaryInner extends ProxyResource { @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) private Integer quantity; + /** + * Customer id to which this product belongs. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * Display name of customer to which this product belongs. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + /** * Invoice section id to which this product belongs. */ @@ -260,6 +272,24 @@ public Integer quantity() { return this.quantity; } + /** + * Get customer id to which this product belongs. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get display name of customer to which this product belongs. + * + * @return the customerDisplayName value + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + /** * Get invoice section id to which this product belongs. * diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransfersInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransfersInner.java index f1eb343eae1e..8391524cfb8e 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransfersInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransfersInner.java @@ -86,7 +86,7 @@ interface TransfersService { /** * Initiates the request to transfer the legacy subscriptions or RIs. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param body Initiate transfer parameters. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -101,7 +101,7 @@ public TransferDetailsInner initiate(String billingAccountName, String invoiceSe /** * Initiates the request to transfer the legacy subscriptions or RIs. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param body Initiate transfer parameters. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -115,7 +115,7 @@ public ServiceFuture initiateAsync(String billingAccountNa /** * Initiates the request to transfer the legacy subscriptions or RIs. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param body Initiate transfer parameters. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -133,7 +133,7 @@ public TransferDetailsInner call(ServiceResponse response) /** * Initiates the request to transfer the legacy subscriptions or RIs. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param body Initiate transfer parameters. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -174,7 +174,7 @@ private ServiceResponse initiateDelegate(Response getAsync(String billingAccountName, S /** * Gets the transfer details for given transfer Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param transferName Transfer Name. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -221,7 +221,7 @@ public TransferDetailsInner call(ServiceResponse response) /** * Gets the transfer details for given transfer Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param transferName Transfer Name. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -261,7 +261,7 @@ private ServiceResponse getDelegate(Response /** * Cancels the transfer for given transfer Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param transferName Transfer Name. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -276,7 +276,7 @@ public TransferDetailsInner cancel(String billingAccountName, String invoiceSect /** * Cancels the transfer for given transfer Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param transferName Transfer Name. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -290,7 +290,7 @@ public ServiceFuture cancelAsync(String billingAccountName /** * Cancels the transfer for given transfer Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param transferName Transfer Name. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -308,7 +308,7 @@ public TransferDetailsInner call(ServiceResponse response) /** * Cancels the transfer for given transfer Id. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param transferName Transfer Name. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -348,7 +348,7 @@ private ServiceResponse cancelDelegate(Response nextPage(String nextPageLink) { /** * Lists all transfer's details initiated from given invoice section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -389,7 +389,7 @@ public Observable>> call(String nextP /** * Lists all transfer's details initiated from given invoice section. * - * @param billingAccountName billing Account Id. + * @param billingAccountName Billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<TransferDetailsInner> object @@ -407,7 +407,7 @@ public Page call(ServiceResponse>> call(ServiceRespo /** * Lists all transfer's details initiated from given invoice section. * - ServiceResponse> * @param billingAccountName billing Account Id. + ServiceResponse> * @param billingAccountName Billing Account Id. ServiceResponse> * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<TransferDetailsInner> object wrapped in {@link ServiceResponse} if successful.