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 new file mode 100644 index 0000000000000..76e7073bc02c3 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalances.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AvailableBalancesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AvailableBalances. + */ +public interface AvailableBalances extends HasInner { + /** + * The latest available credit balance for a given billingAccountName and billingProfileName. + * + * @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 getByBillingProfileAsync(String billingAccountName, String billingProfileName); + +} 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 cf3757a886540..be407544e6701 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 @@ -8,42 +8,41 @@ package com.microsoft.azure.management.billing.v2018_11_01_preview; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonProperty; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingPermissionsInner; +import com.microsoft.azure.arm.model.HasInner; /** - * The set of allowed action and not allowed actions a caller has on a billing - * account. + * Type representing BillingPermissions. */ -public class BillingPermissions { +public interface BillingPermissions extends HasInner { /** - * The set of actions that the caller is allowed to do. - */ - @JsonProperty(value = "actions", access = JsonProperty.Access.WRITE_ONLY) - private List actions; - - /** - * The set of actions the caller is not allowed to do. + * Lists all billing permissions for the caller under a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request */ - @JsonProperty(value = "notActions", access = JsonProperty.Access.WRITE_ONLY) - private List notActions; + Observable listByBillingAccountAsync(String billingAccountName); /** - * Get the set of actions that the caller is allowed to do. + * Lists all billing permissions for the caller under invoice section. * - * @return the actions value + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request */ - public List actions() { - return this.actions; - } + Observable listByInvoiceSectionsAsync(String billingAccountName, String invoiceSectionName); /** - * Get the set of actions the caller is not allowed to do. + * Lists all billingPermissions for the caller has for a billing account. * - * @return the notActions value + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request */ - public List notActions() { - return this.notActions; - } + Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsListResult.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsListResult.java index 4f26d2d59393a..b1753fcf1ddd8 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsListResult.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsListResult.java @@ -21,6 +21,6 @@ public interface BillingPermissionsListResult extends HasInner 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/BillingPermissionsProperties.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsProperties.java new file mode 100644 index 0000000000000..226ab8b1023ff --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsProperties.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of allowed action and not allowed actions a caller has on a billing + * account. + */ +public class BillingPermissionsProperties { + /** + * The set of actions that the caller is allowed to do. + */ + @JsonProperty(value = "actions", access = JsonProperty.Access.WRITE_ONLY) + private List actions; + + /** + * The set of actions the caller is not allowed to do. + */ + @JsonProperty(value = "notActions", access = JsonProperty.Access.WRITE_ONLY) + private List notActions; + + /** + * Get the set of actions that the caller is allowed to do. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Get the set of actions the caller is not allowed to do. + * + * @return the notActions value + */ + public List notActions() { + return this.notActions; + } + +} 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 33e77e61e9544..4ed95175703ad 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 @@ -16,6 +16,15 @@ * Type representing BillingProfiles. */ public interface BillingProfiles extends HasInner { + /** + * 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 for the request + */ + Observable listByBillingAccountNameAsync(String billingAccountName); + /** * Get the billing profile by id. * 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 new file mode 100644 index 0000000000000..29f9058d6d6c2 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignments.java @@ -0,0 +1,140 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Completable; +import rx.Observable; + +/** + * Type representing BillingRoleAssignments. + */ +public interface BillingRoleAssignments { + /** + * Get the role assignment for the caller. + * + * @param billingAccountName billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName); + + /** + * Delete the role assignment on this billing account. + * + * @param billingAccountName billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByBillingAccountNameAsync(String billingAccountName, String billingRoleAssignmentName); + + /** + * Get the role assignment for the caller on the invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName); + + /** + * Delete the role assignment on the invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName); + + /** + * Get the role assignment for the caller on the Billing Profile. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + + /** + * Delete the role assignment on this Billing Profile. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + + /** + * Get the role assignments on the Billing Account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(String billingAccountName); + + /** + * Get the role assignments on the invoice Section. + * + * @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); + + /** + * Get the role assignments on the Billing Profile. + * + * @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); + + /** + * The operation to add a role assignment to a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable addByBillingAccountNameAsync(String billingAccountName); + + /** + * The operation to add a role assignment to a invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable addByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName); + + /** + * The operation to add a role assignment to a billing profile. + * + * @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 addByBillingProfileNameAsync(String billingAccountName, String billingProfileName); + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinition.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinition.java index e589671aeb5d8..5d387216e8937 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinition.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinition.java @@ -46,6 +46,6 @@ public interface BillingRoleDefinition extends HasInner 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/BillingRoleDefinitions.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitions.java new file mode 100644 index 0000000000000..d0154c11f3198 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitions.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingRoleDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingRoleDefinitions. + */ +public interface BillingRoleDefinitions extends HasInner { + /** + * Gets the role definition for a role. + * + * @param billingAccountName billing Account Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingAccountNameAsync(String billingAccountName, String billingRoleDefinitionName); + + /** + * Gets the role definition for a role. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName); + + /** + * Gets the role definition for a role. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName); + + /** + * Lists the role definition for a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(String billingAccountName); + + /** + * Lists the role definition for an invoice Section. + * + * @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); + + /** + * Lists the role definition for a Billing Profile. + * + * @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); + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionSummary.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionSummary.java new file mode 100644 index 0000000000000..acc3e9275d8b9 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionSummary.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingSubscriptionSummaryInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import java.util.UUID; + +/** + * Type representing BillingSubscriptionSummary. + */ +public interface BillingSubscriptionSummary extends HasInner, HasManager { + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the billingProfileName value. + */ + String billingProfileName(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the invoiceSectionName value. + */ + String invoiceSectionName(); + + /** + * @return the lastMonthCharges value. + */ + Amount lastMonthCharges(); + + /** + * @return the monthToDateCharges value. + */ + Amount monthToDateCharges(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * @return the skuId value. + */ + String skuId(); + + /** + * @return the subscriptionBillingStatus value. + */ + BillingSubscriptionStatusType subscriptionBillingStatus(); + + /** + * @return the subscriptionId value. + */ + UUID subscriptionId(); + + /** + * @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/BillingSubscriptions.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptions.java index 4cf3a3e169a7a..5a0b2818c0c45 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptions.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptions.java @@ -17,15 +17,24 @@ */ public interface BillingSubscriptions extends HasInner { /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Lists billing subscriptions by billing profile name. + * + * @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); + + /** + * Lists billing subscription by invoice section name. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. - * @param billingSubscriptionName Billing Subscription Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName); + Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName); /** * Get a single billing subscription by name. @@ -36,6 +45,26 @@ public interface BillingSubscriptions extends HasInner getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName); + Observable getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName); + + /** + * Lists billing subscriptions by billing account name. + * + * @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/BillingSubscriptionsTransferHeaders.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionsTransferHeaders.java new file mode 100644 index 0000000000000..43a6f69033d2a --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionsTransferHeaders.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Transfer operation. + */ +public class BillingSubscriptionsTransferHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommends the retryable time after receiving this. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * URI to poll for the operation status. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the BillingSubscriptionsTransferHeaders object itself. + */ + public BillingSubscriptionsTransferHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommends the retryable time after receiving this. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommends the retryable time after receiving this. + * + * @param retryAfter the retryAfter value to set + * @return the BillingSubscriptionsTransferHeaders object itself. + */ + public BillingSubscriptionsTransferHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get uRI to poll for the operation status. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set uRI to poll for the operation status. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the BillingSubscriptionsTransferHeaders object itself. + */ + public BillingSubscriptionsTransferHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + +} 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 3df9e0b3a05eb..5abbd9c3d1ecd 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 @@ -16,6 +16,15 @@ * Type representing Departments. */ public interface Departments extends HasInner { + /** + * Lists all departments for a user which he has access to. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(String billingAccountName); + /** * Get the department by id. * 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 1c088396cbcf4..6521384f1f0f2 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 @@ -16,6 +16,15 @@ * Type representing EnrollmentAccounts. */ public interface EnrollmentAccounts extends HasInner { + /** + * Lists all Enrollment Accounts for a user which he has access to. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(String billingAccountName); + /** * Get the enrollment account by id. * @@ -24,6 +33,6 @@ public interface EnrollmentAccounts extends HasInner { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getByEnrollmentAccountAccountIdAsync(String billingAccountName, String enrollmentAccountName); + Observable getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName); } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSection.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSection.java index 6da9c6b0e8ffb..510b568f9592c 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSection.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSection.java @@ -11,6 +11,7 @@ import com.microsoft.azure.arm.model.HasInner; import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoiceSectionInner; import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; import com.microsoft.azure.arm.model.Updatable; import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.resources.models.HasManager; @@ -21,7 +22,7 @@ /** * Type representing InvoiceSection. */ -public interface InvoiceSection extends HasInner, Indexable, Updatable, HasManager { +public interface InvoiceSection extends HasInner, Indexable, Refreshable, Updatable, HasManager { /** * @return the billingProfiles value. */ 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 d1932f4bb79b6..bdb154a7552fc 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 @@ -8,8 +8,8 @@ package com.microsoft.azure.management.billing.v2018_11_01_preview; -import rx.Completable; import rx.Observable; +import rx.Completable; import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoiceSectionsInner; import com.microsoft.azure.arm.model.HasInner; @@ -17,6 +17,15 @@ * Type representing InvoiceSections. */ public interface InvoiceSections extends HasInner { + /** + * Lists all invoice sections for a user which he has access to. + * + * @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. * @@ -28,24 +37,24 @@ public interface InvoiceSections extends HasInner { Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName); /** - * Get the InvoiceSection by id. + * Elevates the caller's access to match their billing profile access. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getAsync(String billingAccountName, String invoiceSectionName); + Completable elevateToBillingProfileAsync(String billingAccountName, String invoiceSectionName); /** - * Elevates the caller's access to match their billing profile access. + * Get the InvoiceSection by id. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Completable elevateToBillingProfileAsync(String billingAccountName, String invoiceSectionName); + Observable getAsync(String billingAccountName, String invoiceSectionName); /** * The operation to create a InvoiceSection. @@ -57,4 +66,13 @@ public interface InvoiceSections extends HasInner { */ Observable createAsync(String billingAccountName, InvoiceSectionProperties parameters); + /** + * 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 observable for the request + */ + Observable listByCreateSubscriptionPermissionAsync(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 4c6be39968181..efbfb24a5fb8c 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,18 +9,16 @@ 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.model.Indexable; -import com.microsoft.azure.arm.model.Refreshable; 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; /** * Type representing InvoiceSummary. */ -public interface InvoiceSummary extends HasInner, Indexable, Refreshable, HasManager { +public interface InvoiceSummary extends HasInner, HasManager { /** * @return the amountDue value. */ 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 f4c180bbf3367..c691e046afed3 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,7 +17,30 @@ */ public interface Invoices extends HasInner { /** - * Get the invoice by id. + * List of invoices for a billing account. + * + * @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 listByBillingAccountNameAsync(String billingAccountName, String periodStartDate, String periodEndDate); + + /** + * List of invoices for a billing profile. + * + * @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 listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate); + + /** + * Get the invoice by name. * * @param billingAccountName billing Account Id. * @param billingProfileName Billing Profile Id. 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 new file mode 100644 index 0000000000000..98e885c80b683 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethods.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.PaymentMethodsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PaymentMethods. + */ +public interface PaymentMethods extends HasInner { + /** + * Lists the Payment Methods by billing profile 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(final String billingAccountName, final String billingProfileName); + +} 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 new file mode 100644 index 0000000000000..5e420b2d36898 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policies.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.PolicyInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.PoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Policies. + */ +public interface Policies extends HasInner { + /** + * The policy for a given billing account name and billing profile name. + * + * @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 getByBillingProfileNameAsync(String billingAccountName, String billingProfileName); + + /** + * The operation to update a policy. + * + * @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 + * @return the observable for the request + */ + Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters); + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheetDownloadHeaders.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheetDownloadHeaders.java new file mode 100644 index 0000000000000..505c1929bb331 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheetDownloadHeaders.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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; + +/** + * Defines headers for Download operation. + */ +public class PriceSheetDownloadHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * To get the progress of the operation, call GET operation on the URL in + * Azure-AsyncOperation header field. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * The operation entity Id GUID. + */ + @JsonProperty(value = "OData-EntityId") + private String oDataEntityId; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the PriceSheetDownloadHeaders object itself. + */ + public PriceSheetDownloadHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the PriceSheetDownloadHeaders object itself. + */ + public PriceSheetDownloadHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get to get the progress of the operation, call GET operation on the URL in Azure-AsyncOperation header field. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set to get the progress of the operation, call GET operation on the URL in Azure-AsyncOperation header field. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the PriceSheetDownloadHeaders object itself. + */ + public PriceSheetDownloadHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the operation entity Id GUID. + * + * @return the oDataEntityId value + */ + public String oDataEntityId() { + return this.oDataEntityId; + } + + /** + * Set the operation entity Id GUID. + * + * @param oDataEntityId the oDataEntityId value to set + * @return the PriceSheetDownloadHeaders object itself. + */ + public PriceSheetDownloadHeaders withODataEntityId(String oDataEntityId) { + this.oDataEntityId = oDataEntityId; + return this; + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheets.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheets.java new file mode 100644 index 0000000000000..20e75f835da65 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheets.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.PriceSheetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PriceSheets. + */ +public interface PriceSheets extends HasInner { + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable downloadAsync(String billingAccountName, String invoiceName); + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductSummary.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductSummary.java new file mode 100644 index 0000000000000..bd5d1c4acbb50 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductSummary.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.ProductSummaryInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; + +/** + * Type representing ProductSummary. + */ +public interface ProductSummary extends HasInner, HasManager { + /** + * @return the availabilityId value. + */ + String availabilityId(); + + /** + * @return the billingFrequency value. + */ + BillingFrequency billingFrequency(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the billingProfileName value. + */ + String billingProfileName(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the endDate value. + */ + DateTime endDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the invoiceSectionName value. + */ + String invoiceSectionName(); + + /** + * @return the lastCharge value. + */ + Amount lastCharge(); + + /** + * @return the lastChargeDate value. + */ + DateTime lastChargeDate(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parentProductId value. + */ + String parentProductId(); + + /** + * @return the productType value. + */ + String productType(); + + /** + * @return the productTypeId value. + */ + String productTypeId(); + + /** + * @return the purchaseDate value. + */ + DateTime purchaseDate(); + + /** + * @return the quantity value. + */ + Double quantity(); + + /** + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * @return the skuId value. + */ + String skuId(); + + /** + * @return the status value. + */ + ProductStatusType status(); + + /** + * @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/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 180cfcbdf1018..bb3232b661139 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 @@ -17,15 +17,14 @@ */ public interface Products extends HasInner { /** - * The operation to transfer a Product to another InvoiceSection. + * Lists products by invoice section name. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. - * @param productName Invoice Id. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable transferAsync(String billingAccountName, String invoiceSectionName, String productName); + Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName); /** * Get a single product by name. @@ -36,6 +35,47 @@ public interface Products extends HasInner { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getAsync(String billingAccountName, String invoiceSectionName, String productName); + Observable getAsync(String billingAccountName, String invoiceSectionName, String productName); + + /** + * The operation to transfer a Product to another invoice section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable transferAsync(String billingAccountName, String invoiceSectionName, String productName); + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @param billingAccountName billing Account Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName); + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName); + + /** + * Lists products by billing account name. + * + * @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/Transactions.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transactions.java new file mode 100644 index 0000000000000..640f3709a2e94 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transactions.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.TransactionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Transactions. + */ +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 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); + + /** + * 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); + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName billing Account Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName, final String startDate, final String endDate); + +} 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 e1f5001917489..3ab572815fa2a 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 @@ -50,7 +50,7 @@ public interface Transfers extends HasInner { Completable cancelAsync(String billingAccountName, String invoiceSectionName, String transferName); /** - * Initiates the request to transfer the GTM or legacy subscriptions or RIs to GTM. + * Initiates the request to transfer the legacy subscriptions or RIs. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenewOperationSummary.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenewOperationSummary.java new file mode 100644 index 0000000000000..462c826401e2b --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenewOperationSummary.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.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.UpdateAutoRenewOperationSummaryInner; +import org.joda.time.DateTime; + +/** + * Type representing UpdateAutoRenewOperationSummary. + */ +public interface UpdateAutoRenewOperationSummary extends HasInner, HasManager { + /** + * @return the endDate value. + */ + DateTime endDate(); + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesImpl.java new file mode 100644 index 0000000000000..4838b058cfd1f --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.AvailableBalances; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.AvailableBalance; + +class AvailableBalancesImpl extends WrapperImpl implements AvailableBalances { + private final BillingManager manager; + + AvailableBalancesImpl(BillingManager manager) { + super(manager.inner().availableBalances()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName) { + AvailableBalancesInner client = this.inner(); + return client.getByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public AvailableBalance call(AvailableBalanceInner inner) { + return new AvailableBalanceImpl(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/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 new file mode 100644 index 0000000000000..6d15ce7d31e53 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesInner.java @@ -0,0 +1,143 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AvailableBalances. + */ +public class AvailableBalancesInner { + /** The Retrofit service to perform REST calls. */ + private AvailableBalancesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of AvailableBalancesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AvailableBalancesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(AvailableBalancesService.class); + this.client = client; + } + + /** + * The interface defining all the services for AvailableBalances to be + * used by Retrofit to perform actually REST calls. + */ + interface AvailableBalancesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.AvailableBalances getByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default") + Observable> getByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * The latest available credit balance for a given billingAccountName and billingProfileName. + * + * @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 AvailableBalanceInner object if successful. + */ + public AvailableBalanceInner getByBillingProfile(String billingAccountName, String billingProfileName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * The latest available credit balance for a given billingAccountName and billingProfileName. + * + * @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 getByBillingProfileAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * The latest available credit balance for a given billingAccountName and billingProfileName. + * + * @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 + */ + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, AvailableBalanceInner>() { + @Override + public AvailableBalanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The latest available credit balance for a given billingAccountName and billingProfileName. + * + * @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 + */ + public Observable> getByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName 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.getByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/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 a207479c72961..23b2fc4746b52 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 @@ -8,35 +8,15 @@ package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; -import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureClient; import com.microsoft.azure.AzureServiceClient; -import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; -import com.microsoft.azure.management.billing.v2018_11_01_preview.UpdateAutoRenew; -import com.microsoft.azure.management.billing.v2018_11_01_preview.UpdateAutoRenewRequest; import com.microsoft.rest.credentials.ServiceClientCredentials; import com.microsoft.rest.RestClient; -import com.microsoft.rest.ServiceCallback; -import com.microsoft.rest.ServiceFuture; -import com.microsoft.rest.ServiceResponse; -import java.io.IOException; -import okhttp3.ResponseBody; -import retrofit2.http.Body; -import retrofit2.http.Header; -import retrofit2.http.Headers; -import retrofit2.http.Path; -import retrofit2.http.POST; -import retrofit2.http.Query; -import retrofit2.Response; -import rx.functions.Func1; -import rx.Observable; /** * Initializes a new instance of the BillingManagementClientImpl class. */ public class BillingManagementClientImpl extends AzureServiceClient { - /** The Retrofit service to perform REST calls. */ - private BillingManagementClientService service; /** the {@link AzureClient} used for long running operations. */ private AzureClient azureClient; @@ -166,42 +146,29 @@ public BillingAccountsInner billingAccounts() { } /** - * The AvailableBalanceByBillingProfilesInner object to access its operations. + * The AvailableBalancesInner object to access its operations. */ - private AvailableBalanceByBillingProfilesInner availableBalanceByBillingProfiles; + private AvailableBalancesInner availableBalances; /** - * Gets the AvailableBalanceByBillingProfilesInner object to access its operations. - * @return the AvailableBalanceByBillingProfilesInner object. + * Gets the AvailableBalancesInner object to access its operations. + * @return the AvailableBalancesInner object. */ - public AvailableBalanceByBillingProfilesInner availableBalanceByBillingProfiles() { - return this.availableBalanceByBillingProfiles; + public AvailableBalancesInner availableBalances() { + return this.availableBalances; } /** - * The PaymentMethodsByBillingProfilesInner object to access its operations. + * The PaymentMethodsInner object to access its operations. */ - private PaymentMethodsByBillingProfilesInner paymentMethodsByBillingProfiles; + private PaymentMethodsInner paymentMethods; /** - * Gets the PaymentMethodsByBillingProfilesInner object to access its operations. - * @return the PaymentMethodsByBillingProfilesInner object. + * Gets the PaymentMethodsInner object to access its operations. + * @return the PaymentMethodsInner object. */ - public PaymentMethodsByBillingProfilesInner paymentMethodsByBillingProfiles() { - return this.paymentMethodsByBillingProfiles; - } - - /** - * The BillingProfilesByBillingAccountNamesInner object to access its operations. - */ - private BillingProfilesByBillingAccountNamesInner billingProfilesByBillingAccountNames; - - /** - * Gets the BillingProfilesByBillingAccountNamesInner object to access its operations. - * @return the BillingProfilesByBillingAccountNamesInner object. - */ - public BillingProfilesByBillingAccountNamesInner billingProfilesByBillingAccountNames() { - return this.billingProfilesByBillingAccountNames; + public PaymentMethodsInner paymentMethods() { + return this.paymentMethods; } /** @@ -217,19 +184,6 @@ public BillingProfilesInner billingProfiles() { return this.billingProfiles; } - /** - * The InvoiceSectionsByBillingAccountNamesInner object to access its operations. - */ - private InvoiceSectionsByBillingAccountNamesInner invoiceSectionsByBillingAccountNames; - - /** - * Gets the InvoiceSectionsByBillingAccountNamesInner object to access its operations. - * @return the InvoiceSectionsByBillingAccountNamesInner object. - */ - public InvoiceSectionsByBillingAccountNamesInner invoiceSectionsByBillingAccountNames() { - return this.invoiceSectionsByBillingAccountNames; - } - /** * The InvoiceSectionsInner object to access its operations. */ @@ -243,32 +197,6 @@ public InvoiceSectionsInner invoiceSections() { return this.invoiceSections; } - /** - * The InvoiceSectionsWithCreateSubscriptionPermissionsInner object to access its operations. - */ - private InvoiceSectionsWithCreateSubscriptionPermissionsInner invoiceSectionsWithCreateSubscriptionPermissions; - - /** - * Gets the InvoiceSectionsWithCreateSubscriptionPermissionsInner object to access its operations. - * @return the InvoiceSectionsWithCreateSubscriptionPermissionsInner object. - */ - public InvoiceSectionsWithCreateSubscriptionPermissionsInner invoiceSectionsWithCreateSubscriptionPermissions() { - return this.invoiceSectionsWithCreateSubscriptionPermissions; - } - - /** - * The DepartmentsByBillingAccountNamesInner object to access its operations. - */ - private DepartmentsByBillingAccountNamesInner departmentsByBillingAccountNames; - - /** - * Gets the DepartmentsByBillingAccountNamesInner object to access its operations. - * @return the DepartmentsByBillingAccountNamesInner object. - */ - public DepartmentsByBillingAccountNamesInner departmentsByBillingAccountNames() { - return this.departmentsByBillingAccountNames; - } - /** * The DepartmentsInner object to access its operations. */ @@ -282,19 +210,6 @@ public DepartmentsInner departments() { return this.departments; } - /** - * The EnrollmentAccountsByBillingAccountNamesInner object to access its operations. - */ - private EnrollmentAccountsByBillingAccountNamesInner enrollmentAccountsByBillingAccountNames; - - /** - * Gets the EnrollmentAccountsByBillingAccountNamesInner object to access its operations. - * @return the EnrollmentAccountsByBillingAccountNamesInner object. - */ - public EnrollmentAccountsByBillingAccountNamesInner enrollmentAccountsByBillingAccountNames() { - return this.enrollmentAccountsByBillingAccountNames; - } - /** * The EnrollmentAccountsInner object to access its operations. */ @@ -308,45 +223,6 @@ public EnrollmentAccountsInner enrollmentAccounts() { return this.enrollmentAccounts; } - /** - * The InvoicesByBillingAccountsInner object to access its operations. - */ - private InvoicesByBillingAccountsInner invoicesByBillingAccounts; - - /** - * Gets the InvoicesByBillingAccountsInner object to access its operations. - * @return the InvoicesByBillingAccountsInner object. - */ - public InvoicesByBillingAccountsInner invoicesByBillingAccounts() { - return this.invoicesByBillingAccounts; - } - - /** - * The InvoicePricesheetsInner object to access its operations. - */ - private InvoicePricesheetsInner invoicePricesheets; - - /** - * Gets the InvoicePricesheetsInner object to access its operations. - * @return the InvoicePricesheetsInner object. - */ - public InvoicePricesheetsInner invoicePricesheets() { - return this.invoicePricesheets; - } - - /** - * The InvoicesByBillingProfilesInner object to access its operations. - */ - private InvoicesByBillingProfilesInner invoicesByBillingProfiles; - - /** - * Gets the InvoicesByBillingProfilesInner object to access its operations. - * @return the InvoicesByBillingProfilesInner object. - */ - public InvoicesByBillingProfilesInner invoicesByBillingProfiles() { - return this.invoicesByBillingProfiles; - } - /** * The InvoicesInner object to access its operations. */ @@ -361,42 +237,16 @@ public InvoicesInner invoices() { } /** - * The ProductsByBillingSubscriptionsInner object to access its operations. + * The PriceSheetsInner object to access its operations. */ - private ProductsByBillingSubscriptionsInner productsByBillingSubscriptions; + private PriceSheetsInner priceSheets; /** - * Gets the ProductsByBillingSubscriptionsInner object to access its operations. - * @return the ProductsByBillingSubscriptionsInner object. + * Gets the PriceSheetsInner object to access its operations. + * @return the PriceSheetsInner object. */ - public ProductsByBillingSubscriptionsInner productsByBillingSubscriptions() { - return this.productsByBillingSubscriptions; - } - - /** - * The BillingSubscriptionsByBillingProfilesInner object to access its operations. - */ - private BillingSubscriptionsByBillingProfilesInner billingSubscriptionsByBillingProfiles; - - /** - * Gets the BillingSubscriptionsByBillingProfilesInner object to access its operations. - * @return the BillingSubscriptionsByBillingProfilesInner object. - */ - public BillingSubscriptionsByBillingProfilesInner billingSubscriptionsByBillingProfiles() { - return this.billingSubscriptionsByBillingProfiles; - } - - /** - * The BillingSubscriptionsByInvoiceSectionsInner object to access its operations. - */ - private BillingSubscriptionsByInvoiceSectionsInner billingSubscriptionsByInvoiceSections; - - /** - * Gets the BillingSubscriptionsByInvoiceSectionsInner object to access its operations. - * @return the BillingSubscriptionsByInvoiceSectionsInner object. - */ - public BillingSubscriptionsByInvoiceSectionsInner billingSubscriptionsByInvoiceSections() { - return this.billingSubscriptionsByInvoiceSections; + public PriceSheetsInner priceSheets() { + return this.priceSheets; } /** @@ -412,32 +262,6 @@ public BillingSubscriptionsInner billingSubscriptions() { return this.billingSubscriptions; } - /** - * The ProductsByBillingAccountsInner object to access its operations. - */ - private ProductsByBillingAccountsInner productsByBillingAccounts; - - /** - * Gets the ProductsByBillingAccountsInner object to access its operations. - * @return the ProductsByBillingAccountsInner object. - */ - public ProductsByBillingAccountsInner productsByBillingAccounts() { - return this.productsByBillingAccounts; - } - - /** - * The ProductsByInvoiceSectionsInner object to access its operations. - */ - private ProductsByInvoiceSectionsInner productsByInvoiceSections; - - /** - * Gets the ProductsByInvoiceSectionsInner object to access its operations. - * @return the ProductsByInvoiceSectionsInner object. - */ - public ProductsByInvoiceSectionsInner productsByInvoiceSections() { - return this.productsByInvoiceSections; - } - /** * The ProductsInner object to access its operations. */ @@ -452,55 +276,29 @@ public ProductsInner products() { } /** - * The TransactionsByBillingAccountsInner object to access its operations. - */ - private TransactionsByBillingAccountsInner transactionsByBillingAccounts; - - /** - * Gets the TransactionsByBillingAccountsInner object to access its operations. - * @return the TransactionsByBillingAccountsInner object. - */ - public TransactionsByBillingAccountsInner transactionsByBillingAccounts() { - return this.transactionsByBillingAccounts; - } - - /** - * The TransactionsByBillingProfilesInner object to access its operations. + * The TransactionsInner object to access its operations. */ - private TransactionsByBillingProfilesInner transactionsByBillingProfiles; + private TransactionsInner transactions; /** - * Gets the TransactionsByBillingProfilesInner object to access its operations. - * @return the TransactionsByBillingProfilesInner object. + * Gets the TransactionsInner object to access its operations. + * @return the TransactionsInner object. */ - public TransactionsByBillingProfilesInner transactionsByBillingProfiles() { - return this.transactionsByBillingProfiles; + public TransactionsInner transactions() { + return this.transactions; } /** - * The TransactionsByInvoiceSectionsInner object to access its operations. + * The PoliciesInner object to access its operations. */ - private TransactionsByInvoiceSectionsInner transactionsByInvoiceSections; + private PoliciesInner policies; /** - * Gets the TransactionsByInvoiceSectionsInner object to access its operations. - * @return the TransactionsByInvoiceSectionsInner object. + * Gets the PoliciesInner object to access its operations. + * @return the PoliciesInner object. */ - public TransactionsByInvoiceSectionsInner transactionsByInvoiceSections() { - return this.transactionsByInvoiceSections; - } - - /** - * The PolicysInner object to access its operations. - */ - private PolicysInner policys; - - /** - * Gets the PolicysInner object to access its operations. - * @return the PolicysInner object. - */ - public PolicysInner policys() { - return this.policys; + public PoliciesInner policies() { + return this.policies; } /** @@ -556,120 +354,42 @@ public OperationsInner operations() { } /** - * The BillingAccountBillingPermissionsInner object to access its operations. + * The BillingPermissionsInner object to access its operations. */ - private BillingAccountBillingPermissionsInner billingAccountBillingPermissions; + private BillingPermissionsInner billingPermissions; /** - * Gets the BillingAccountBillingPermissionsInner object to access its operations. - * @return the BillingAccountBillingPermissionsInner object. + * Gets the BillingPermissionsInner object to access its operations. + * @return the BillingPermissionsInner object. */ - public BillingAccountBillingPermissionsInner billingAccountBillingPermissions() { - return this.billingAccountBillingPermissions; + public BillingPermissionsInner billingPermissions() { + return this.billingPermissions; } /** - * The InvoiceSectionsBillingPermissionsInner object to access its operations. + * The BillingRoleDefinitionsInner object to access its operations. */ - private InvoiceSectionsBillingPermissionsInner invoiceSectionsBillingPermissions; + private BillingRoleDefinitionsInner billingRoleDefinitions; /** - * Gets the InvoiceSectionsBillingPermissionsInner object to access its operations. - * @return the InvoiceSectionsBillingPermissionsInner object. + * Gets the BillingRoleDefinitionsInner object to access its operations. + * @return the BillingRoleDefinitionsInner object. */ - public InvoiceSectionsBillingPermissionsInner invoiceSectionsBillingPermissions() { - return this.invoiceSectionsBillingPermissions; + public BillingRoleDefinitionsInner billingRoleDefinitions() { + return this.billingRoleDefinitions; } /** - * The BillingProfileBillingPermissionsInner object to access its operations. + * The BillingRoleAssignmentsInner object to access its operations. */ - private BillingProfileBillingPermissionsInner billingProfileBillingPermissions; + private BillingRoleAssignmentsInner billingRoleAssignments; /** - * Gets the BillingProfileBillingPermissionsInner object to access its operations. - * @return the BillingProfileBillingPermissionsInner object. + * Gets the BillingRoleAssignmentsInner object to access its operations. + * @return the BillingRoleAssignmentsInner object. */ - public BillingProfileBillingPermissionsInner billingProfileBillingPermissions() { - return this.billingProfileBillingPermissions; - } - - /** - * The BillingAccountBillingRoleDefinitionsInner object to access its operations. - */ - private BillingAccountBillingRoleDefinitionsInner billingAccountBillingRoleDefinitions; - - /** - * Gets the BillingAccountBillingRoleDefinitionsInner object to access its operations. - * @return the BillingAccountBillingRoleDefinitionsInner object. - */ - public BillingAccountBillingRoleDefinitionsInner billingAccountBillingRoleDefinitions() { - return this.billingAccountBillingRoleDefinitions; - } - - /** - * The InvoiceSectionBillingRoleDefinitionsInner object to access its operations. - */ - private InvoiceSectionBillingRoleDefinitionsInner invoiceSectionBillingRoleDefinitions; - - /** - * Gets the InvoiceSectionBillingRoleDefinitionsInner object to access its operations. - * @return the InvoiceSectionBillingRoleDefinitionsInner object. - */ - public InvoiceSectionBillingRoleDefinitionsInner invoiceSectionBillingRoleDefinitions() { - return this.invoiceSectionBillingRoleDefinitions; - } - - /** - * The BillingProfileBillingRoleDefinitionsInner object to access its operations. - */ - private BillingProfileBillingRoleDefinitionsInner billingProfileBillingRoleDefinitions; - - /** - * Gets the BillingProfileBillingRoleDefinitionsInner object to access its operations. - * @return the BillingProfileBillingRoleDefinitionsInner object. - */ - public BillingProfileBillingRoleDefinitionsInner billingProfileBillingRoleDefinitions() { - return this.billingProfileBillingRoleDefinitions; - } - - /** - * The BillingAccountBillingRoleAssignmentsInner object to access its operations. - */ - private BillingAccountBillingRoleAssignmentsInner billingAccountBillingRoleAssignments; - - /** - * Gets the BillingAccountBillingRoleAssignmentsInner object to access its operations. - * @return the BillingAccountBillingRoleAssignmentsInner object. - */ - public BillingAccountBillingRoleAssignmentsInner billingAccountBillingRoleAssignments() { - return this.billingAccountBillingRoleAssignments; - } - - /** - * The InvoiceSectionBillingRoleAssignmentsInner object to access its operations. - */ - private InvoiceSectionBillingRoleAssignmentsInner invoiceSectionBillingRoleAssignments; - - /** - * Gets the InvoiceSectionBillingRoleAssignmentsInner object to access its operations. - * @return the InvoiceSectionBillingRoleAssignmentsInner object. - */ - public InvoiceSectionBillingRoleAssignmentsInner invoiceSectionBillingRoleAssignments() { - return this.invoiceSectionBillingRoleAssignments; - } - - /** - * The BillingProfileBillingRoleAssignmentsInner object to access its operations. - */ - private BillingProfileBillingRoleAssignmentsInner billingProfileBillingRoleAssignments; - - /** - * Gets the BillingProfileBillingRoleAssignmentsInner object to access its operations. - * @return the BillingProfileBillingRoleAssignmentsInner object. - */ - public BillingProfileBillingRoleAssignmentsInner billingProfileBillingRoleAssignments() { - return this.billingProfileBillingRoleAssignments; + public BillingRoleAssignmentsInner billingRoleAssignments() { + return this.billingRoleAssignments; } /** @@ -721,48 +441,27 @@ protected void initialize() { this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; this.billingAccounts = new BillingAccountsInner(restClient().retrofit(), this); - this.availableBalanceByBillingProfiles = new AvailableBalanceByBillingProfilesInner(restClient().retrofit(), this); - this.paymentMethodsByBillingProfiles = new PaymentMethodsByBillingProfilesInner(restClient().retrofit(), this); - this.billingProfilesByBillingAccountNames = new BillingProfilesByBillingAccountNamesInner(restClient().retrofit(), this); + this.availableBalances = new AvailableBalancesInner(restClient().retrofit(), this); + this.paymentMethods = new PaymentMethodsInner(restClient().retrofit(), this); this.billingProfiles = new BillingProfilesInner(restClient().retrofit(), this); - this.invoiceSectionsByBillingAccountNames = new InvoiceSectionsByBillingAccountNamesInner(restClient().retrofit(), this); this.invoiceSections = new InvoiceSectionsInner(restClient().retrofit(), this); - this.invoiceSectionsWithCreateSubscriptionPermissions = new InvoiceSectionsWithCreateSubscriptionPermissionsInner(restClient().retrofit(), this); - this.departmentsByBillingAccountNames = new DepartmentsByBillingAccountNamesInner(restClient().retrofit(), this); this.departments = new DepartmentsInner(restClient().retrofit(), this); - this.enrollmentAccountsByBillingAccountNames = new EnrollmentAccountsByBillingAccountNamesInner(restClient().retrofit(), this); this.enrollmentAccounts = new EnrollmentAccountsInner(restClient().retrofit(), this); - this.invoicesByBillingAccounts = new InvoicesByBillingAccountsInner(restClient().retrofit(), this); - this.invoicePricesheets = new InvoicePricesheetsInner(restClient().retrofit(), this); - this.invoicesByBillingProfiles = new InvoicesByBillingProfilesInner(restClient().retrofit(), this); this.invoices = new InvoicesInner(restClient().retrofit(), this); - this.productsByBillingSubscriptions = new ProductsByBillingSubscriptionsInner(restClient().retrofit(), this); - this.billingSubscriptionsByBillingProfiles = new BillingSubscriptionsByBillingProfilesInner(restClient().retrofit(), this); - this.billingSubscriptionsByInvoiceSections = new BillingSubscriptionsByInvoiceSectionsInner(restClient().retrofit(), this); + this.priceSheets = new PriceSheetsInner(restClient().retrofit(), this); this.billingSubscriptions = new BillingSubscriptionsInner(restClient().retrofit(), this); - this.productsByBillingAccounts = new ProductsByBillingAccountsInner(restClient().retrofit(), this); - this.productsByInvoiceSections = new ProductsByInvoiceSectionsInner(restClient().retrofit(), this); this.products = new ProductsInner(restClient().retrofit(), this); - this.transactionsByBillingAccounts = new TransactionsByBillingAccountsInner(restClient().retrofit(), this); - this.transactionsByBillingProfiles = new TransactionsByBillingProfilesInner(restClient().retrofit(), this); - this.transactionsByInvoiceSections = new TransactionsByInvoiceSectionsInner(restClient().retrofit(), this); - this.policys = new PolicysInner(restClient().retrofit(), this); + this.transactions = new TransactionsInner(restClient().retrofit(), this); + this.policies = new PoliciesInner(restClient().retrofit(), this); this.billingPropertys = new BillingPropertysInner(restClient().retrofit(), this); this.transfers = new TransfersInner(restClient().retrofit(), this); this.recipientTransfers = new RecipientTransfersInner(restClient().retrofit(), this); this.operations = new OperationsInner(restClient().retrofit(), this); - this.billingAccountBillingPermissions = new BillingAccountBillingPermissionsInner(restClient().retrofit(), this); - this.invoiceSectionsBillingPermissions = new InvoiceSectionsBillingPermissionsInner(restClient().retrofit(), this); - this.billingProfileBillingPermissions = new BillingProfileBillingPermissionsInner(restClient().retrofit(), this); - this.billingAccountBillingRoleDefinitions = new BillingAccountBillingRoleDefinitionsInner(restClient().retrofit(), this); - this.invoiceSectionBillingRoleDefinitions = new InvoiceSectionBillingRoleDefinitionsInner(restClient().retrofit(), this); - this.billingProfileBillingRoleDefinitions = new BillingProfileBillingRoleDefinitionsInner(restClient().retrofit(), this); - this.billingAccountBillingRoleAssignments = new BillingAccountBillingRoleAssignmentsInner(restClient().retrofit(), this); - this.invoiceSectionBillingRoleAssignments = new InvoiceSectionBillingRoleAssignmentsInner(restClient().retrofit(), this); - this.billingProfileBillingRoleAssignments = new BillingProfileBillingRoleAssignmentsInner(restClient().retrofit(), this); + this.billingPermissions = new BillingPermissionsInner(restClient().retrofit(), this); + this.billingRoleDefinitions = new BillingRoleDefinitionsInner(restClient().retrofit(), this); + this.billingRoleAssignments = new BillingRoleAssignmentsInner(restClient().retrofit(), this); this.agreements = new AgreementsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); - initializeService(); } /** @@ -774,374 +473,4 @@ protected void initialize() { public String userAgent() { return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "BillingManagementClient", "2018-11-01-preview"); } - - private void initializeService() { - service = restClient().retrofit().create(BillingManagementClientService.class); - } - - /** - * The interface defining all the services for BillingManagementClient to be - * used by Retrofit to perform actually REST calls. - */ - interface BillingManagementClientService { - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingManagementClient updateAutoRenewForBillingAccount" }) - @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/updateAutoRenew") - Observable> updateAutoRenewForBillingAccount(@Path("billingAccountName") String billingAccountName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UpdateAutoRenewRequest body, @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.BillingManagementClient updateAutoRenewForInvoiceSection" }) - @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew") - Observable> updateAutoRenewForInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UpdateAutoRenewRequest body, @Header("User-Agent") String userAgent); - - } - - /** - * Cancel product by product 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 - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the UpdateAutoRenewOperationSummaryInner object if successful. - */ - public UpdateAutoRenewOperationSummaryInner updateAutoRenewForBillingAccount(String billingAccountName, String productName) { - return updateAutoRenewForBillingAccountWithServiceResponseAsync(billingAccountName, productName).toBlocking().single().body(); - } - - /** - * Cancel product by product 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 - * @return the {@link ServiceFuture} object - */ - public ServiceFuture updateAutoRenewForBillingAccountAsync(String billingAccountName, String productName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateAutoRenewForBillingAccountWithServiceResponseAsync(billingAccountName, productName), serviceCallback); - } - - /** - * Cancel product by product 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 - */ - public Observable updateAutoRenewForBillingAccountAsync(String billingAccountName, String productName) { - return updateAutoRenewForBillingAccountWithServiceResponseAsync(billingAccountName, productName).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { - @Override - public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Cancel product by product 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 - */ - public Observable> updateAutoRenewForBillingAccountWithServiceResponseAsync(String billingAccountName, String productName) { - if (billingAccountName == null) { - throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); - } - if (productName == null) { - throw new IllegalArgumentException("Parameter productName is required and cannot be null."); - } - if (this.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); - } - final UpdateAutoRenew autoRenew = null; - UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); - body.withAutoRenew(null); - return service.updateAutoRenewForBillingAccount(billingAccountName, productName, this.apiVersion(), this.acceptLanguage(), body, this.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = updateAutoRenewForBillingAccountDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - /** - * Cancel product by product 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 - * @throws ErrorResponseException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the UpdateAutoRenewOperationSummaryInner object if successful. - */ - public UpdateAutoRenewOperationSummaryInner updateAutoRenewForBillingAccount(String billingAccountName, String productName, UpdateAutoRenew autoRenew) { - return updateAutoRenewForBillingAccountWithServiceResponseAsync(billingAccountName, productName, autoRenew).toBlocking().single().body(); - } - - /** - * Cancel product by product 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. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture updateAutoRenewForBillingAccountAsync(String billingAccountName, String productName, UpdateAutoRenew autoRenew, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateAutoRenewForBillingAccountWithServiceResponseAsync(billingAccountName, productName, autoRenew), serviceCallback); - } - - /** - * Cancel product by product 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 - * @return the observable to the UpdateAutoRenewOperationSummaryInner object - */ - public Observable updateAutoRenewForBillingAccountAsync(String billingAccountName, String productName, UpdateAutoRenew autoRenew) { - return updateAutoRenewForBillingAccountWithServiceResponseAsync(billingAccountName, productName, autoRenew).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { - @Override - public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Cancel product by product 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 - * @return the observable to the UpdateAutoRenewOperationSummaryInner object - */ - public Observable> updateAutoRenewForBillingAccountWithServiceResponseAsync(String billingAccountName, String productName, UpdateAutoRenew autoRenew) { - if (billingAccountName == null) { - throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); - } - if (productName == null) { - throw new IllegalArgumentException("Parameter productName is required and cannot be null."); - } - if (this.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); - } - UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); - body.withAutoRenew(autoRenew); - return service.updateAutoRenewForBillingAccount(billingAccountName, productName, this.apiVersion(), this.acceptLanguage(), body, this.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = updateAutoRenewForBillingAccountDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse updateAutoRenewForBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(ErrorResponseException.class) - .build(response); - } - - /** - * Cancel auto renew for product by product id. - * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. - * @param productName Invoice 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 UpdateAutoRenewOperationSummaryInner object if successful. - */ - public UpdateAutoRenewOperationSummaryInner updateAutoRenewForInvoiceSection(String billingAccountName, String invoiceSectionName, String productName) { - return updateAutoRenewForInvoiceSectionWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName).toBlocking().single().body(); - } - - /** - * Cancel auto renew for product by product 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. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture updateAutoRenewForInvoiceSectionAsync(String billingAccountName, String invoiceSectionName, String productName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateAutoRenewForInvoiceSectionWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName), serviceCallback); - } - - /** - * Cancel auto renew for product by product id. - * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. - * @param productName Invoice Id. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the UpdateAutoRenewOperationSummaryInner object - */ - public Observable updateAutoRenewForInvoiceSectionAsync(String billingAccountName, String invoiceSectionName, String productName) { - return updateAutoRenewForInvoiceSectionWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { - @Override - public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Cancel auto renew for product by product id. - * - * @param billingAccountName billing Account Id. - * @param invoiceSectionName InvoiceSection Id. - * @param productName Invoice Id. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the UpdateAutoRenewOperationSummaryInner object - */ - public Observable> updateAutoRenewForInvoiceSectionWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String productName) { - 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 (productName == null) { - throw new IllegalArgumentException("Parameter productName is required and cannot be null."); - } - if (this.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); - } - final UpdateAutoRenew autoRenew = null; - UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); - body.withAutoRenew(null); - return service.updateAutoRenewForInvoiceSection(billingAccountName, invoiceSectionName, productName, this.apiVersion(), this.acceptLanguage(), body, this.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = updateAutoRenewForInvoiceSectionDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - /** - * Cancel auto renew for product by product 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' - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws ErrorResponseException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the UpdateAutoRenewOperationSummaryInner object if successful. - */ - public UpdateAutoRenewOperationSummaryInner updateAutoRenewForInvoiceSection(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { - return updateAutoRenewForInvoiceSectionWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, autoRenew).toBlocking().single().body(); - } - - /** - * Cancel auto renew for product by product 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' - * @param serviceCallback the async ServiceCallback to handle successful and failed responses. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceFuture} object - */ - public ServiceFuture updateAutoRenewForInvoiceSectionAsync(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateAutoRenewForInvoiceSectionWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, autoRenew), serviceCallback); - } - - /** - * Cancel auto renew for product by product 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' - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the UpdateAutoRenewOperationSummaryInner object - */ - public Observable updateAutoRenewForInvoiceSectionAsync(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { - return updateAutoRenewForInvoiceSectionWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, autoRenew).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { - @Override - public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Cancel auto renew for product by product 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' - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the UpdateAutoRenewOperationSummaryInner object - */ - public Observable> updateAutoRenewForInvoiceSectionWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { - 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 (productName == null) { - throw new IllegalArgumentException("Parameter productName is required and cannot be null."); - } - if (this.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); - } - UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); - body.withAutoRenew(autoRenew); - return service.updateAutoRenewForInvoiceSection(billingAccountName, invoiceSectionName, productName, this.apiVersion(), this.acceptLanguage(), body, this.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = updateAutoRenewForInvoiceSectionDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse updateAutoRenewForInvoiceSectionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.restClient().responseBuilderFactory().newInstance(this.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/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 8a139201efb91..7f6906de46932 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 @@ -17,45 +17,25 @@ import com.microsoft.azure.serializer.AzureJacksonAdapter; import com.microsoft.rest.RestClient; import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccounts; -import com.microsoft.azure.management.billing.v2018_11_01_preview.AvailableBalanceByBillingProfiles; -import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethodsByBillingProfiles; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfilesByBillingAccountNames; +import com.microsoft.azure.management.billing.v2018_11_01_preview.AvailableBalances; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethods; import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfiles; -import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionsByBillingAccountNames; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections; -import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionsWithCreateSubscriptionPermissions; -import com.microsoft.azure.management.billing.v2018_11_01_preview.DepartmentsByBillingAccountNames; import com.microsoft.azure.management.billing.v2018_11_01_preview.Departments; -import com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccountsByBillingAccountNames; import com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccounts; -import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoicesByBillingAccounts; -import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoicePricesheets; -import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoicesByBillingProfiles; import com.microsoft.azure.management.billing.v2018_11_01_preview.Invoices; -import com.microsoft.azure.management.billing.v2018_11_01_preview.ProductsByBillingSubscriptions; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionsByBillingProfiles; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionsByInvoiceSections; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PriceSheets; import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions; -import com.microsoft.azure.management.billing.v2018_11_01_preview.ProductsByBillingAccounts; -import com.microsoft.azure.management.billing.v2018_11_01_preview.ProductsByInvoiceSections; import com.microsoft.azure.management.billing.v2018_11_01_preview.Products; -import com.microsoft.azure.management.billing.v2018_11_01_preview.TransactionsByBillingAccounts; -import com.microsoft.azure.management.billing.v2018_11_01_preview.TransactionsByBillingProfiles; -import com.microsoft.azure.management.billing.v2018_11_01_preview.TransactionsByInvoiceSections; -import com.microsoft.azure.management.billing.v2018_11_01_preview.Policys; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Policies; import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPropertys; import com.microsoft.azure.management.billing.v2018_11_01_preview.Transfers; import com.microsoft.azure.management.billing.v2018_11_01_preview.RecipientTransfers; import com.microsoft.azure.management.billing.v2018_11_01_preview.Operations; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccountBillingPermissions; -import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionsBillingPermissions; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfileBillingPermissions; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccountBillingRoleDefinitions; -import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionBillingRoleDefinitions; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfileBillingRoleDefinitions; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccountBillingRoleAssignments; -import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionBillingRoleAssignments; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfileBillingRoleAssignments; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments; import com.microsoft.azure.management.billing.v2018_11_01_preview.Agreements; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -65,45 +45,25 @@ */ public final class BillingManager extends ManagerCore { private BillingAccounts billingAccounts; - private AvailableBalanceByBillingProfiles availableBalanceByBillingProfiles; - private PaymentMethodsByBillingProfiles paymentMethodsByBillingProfiles; - private BillingProfilesByBillingAccountNames billingProfilesByBillingAccountNames; + private AvailableBalances availableBalances; + private PaymentMethods paymentMethods; private BillingProfiles billingProfiles; - private InvoiceSectionsByBillingAccountNames invoiceSectionsByBillingAccountNames; private InvoiceSections invoiceSections; - private InvoiceSectionsWithCreateSubscriptionPermissions invoiceSectionsWithCreateSubscriptionPermissions; - private DepartmentsByBillingAccountNames departmentsByBillingAccountNames; private Departments departments; - private EnrollmentAccountsByBillingAccountNames enrollmentAccountsByBillingAccountNames; private EnrollmentAccounts enrollmentAccounts; - private InvoicesByBillingAccounts invoicesByBillingAccounts; - private InvoicePricesheets invoicePricesheets; - private InvoicesByBillingProfiles invoicesByBillingProfiles; private Invoices invoices; - private ProductsByBillingSubscriptions productsByBillingSubscriptions; - private BillingSubscriptionsByBillingProfiles billingSubscriptionsByBillingProfiles; - private BillingSubscriptionsByInvoiceSections billingSubscriptionsByInvoiceSections; + private PriceSheets priceSheets; private BillingSubscriptions billingSubscriptions; - private ProductsByBillingAccounts productsByBillingAccounts; - private ProductsByInvoiceSections productsByInvoiceSections; private Products products; - private TransactionsByBillingAccounts transactionsByBillingAccounts; - private TransactionsByBillingProfiles transactionsByBillingProfiles; - private TransactionsByInvoiceSections transactionsByInvoiceSections; - private Policys policys; + private Transactions transactions; + private Policies policies; private BillingPropertys billingPropertys; private Transfers transfers; private RecipientTransfers recipientTransfers; private Operations operations; - private BillingAccountBillingPermissions billingAccountBillingPermissions; - private InvoiceSectionsBillingPermissions invoiceSectionsBillingPermissions; - private BillingProfileBillingPermissions billingProfileBillingPermissions; - private BillingAccountBillingRoleDefinitions billingAccountBillingRoleDefinitions; - private InvoiceSectionBillingRoleDefinitions invoiceSectionBillingRoleDefinitions; - private BillingProfileBillingRoleDefinitions billingProfileBillingRoleDefinitions; - private BillingAccountBillingRoleAssignments billingAccountBillingRoleAssignments; - private InvoiceSectionBillingRoleAssignments invoiceSectionBillingRoleAssignments; - private BillingProfileBillingRoleAssignments billingProfileBillingRoleAssignments; + private BillingPermissions billingPermissions; + private BillingRoleDefinitions billingRoleDefinitions; + private BillingRoleAssignments billingRoleAssignments; private Agreements agreements; /** * Get a Configurable instance that can be used to create BillingManager with optional configuration. @@ -163,33 +123,23 @@ public BillingAccounts billingAccounts() { } /** - * @return Entry point to manage AvailableBalanceByBillingProfiles. + * @return Entry point to manage AvailableBalances. */ - public AvailableBalanceByBillingProfiles availableBalanceByBillingProfiles() { - if (this.availableBalanceByBillingProfiles == null) { - this.availableBalanceByBillingProfiles = new AvailableBalanceByBillingProfilesImpl(this); + public AvailableBalances availableBalances() { + if (this.availableBalances == null) { + this.availableBalances = new AvailableBalancesImpl(this); } - return this.availableBalanceByBillingProfiles; + return this.availableBalances; } /** - * @return Entry point to manage PaymentMethodsByBillingProfiles. + * @return Entry point to manage PaymentMethods. */ - public PaymentMethodsByBillingProfiles paymentMethodsByBillingProfiles() { - if (this.paymentMethodsByBillingProfiles == null) { - this.paymentMethodsByBillingProfiles = new PaymentMethodsByBillingProfilesImpl(this); + public PaymentMethods paymentMethods() { + if (this.paymentMethods == null) { + this.paymentMethods = new PaymentMethodsImpl(this); } - return this.paymentMethodsByBillingProfiles; - } - - /** - * @return Entry point to manage BillingProfilesByBillingAccountNames. - */ - public BillingProfilesByBillingAccountNames billingProfilesByBillingAccountNames() { - if (this.billingProfilesByBillingAccountNames == null) { - this.billingProfilesByBillingAccountNames = new BillingProfilesByBillingAccountNamesImpl(this); - } - return this.billingProfilesByBillingAccountNames; + return this.paymentMethods; } /** @@ -202,16 +152,6 @@ public BillingProfiles billingProfiles() { return this.billingProfiles; } - /** - * @return Entry point to manage InvoiceSectionsByBillingAccountNames. - */ - public InvoiceSectionsByBillingAccountNames invoiceSectionsByBillingAccountNames() { - if (this.invoiceSectionsByBillingAccountNames == null) { - this.invoiceSectionsByBillingAccountNames = new InvoiceSectionsByBillingAccountNamesImpl(this); - } - return this.invoiceSectionsByBillingAccountNames; - } - /** * @return Entry point to manage InvoiceSections. */ @@ -222,26 +162,6 @@ public InvoiceSections invoiceSections() { return this.invoiceSections; } - /** - * @return Entry point to manage InvoiceSectionsWithCreateSubscriptionPermissions. - */ - public InvoiceSectionsWithCreateSubscriptionPermissions invoiceSectionsWithCreateSubscriptionPermissions() { - if (this.invoiceSectionsWithCreateSubscriptionPermissions == null) { - this.invoiceSectionsWithCreateSubscriptionPermissions = new InvoiceSectionsWithCreateSubscriptionPermissionsImpl(this); - } - return this.invoiceSectionsWithCreateSubscriptionPermissions; - } - - /** - * @return Entry point to manage DepartmentsByBillingAccountNames. - */ - public DepartmentsByBillingAccountNames departmentsByBillingAccountNames() { - if (this.departmentsByBillingAccountNames == null) { - this.departmentsByBillingAccountNames = new DepartmentsByBillingAccountNamesImpl(this); - } - return this.departmentsByBillingAccountNames; - } - /** * @return Entry point to manage Departments. */ @@ -252,16 +172,6 @@ public Departments departments() { return this.departments; } - /** - * @return Entry point to manage EnrollmentAccountsByBillingAccountNames. - */ - public EnrollmentAccountsByBillingAccountNames enrollmentAccountsByBillingAccountNames() { - if (this.enrollmentAccountsByBillingAccountNames == null) { - this.enrollmentAccountsByBillingAccountNames = new EnrollmentAccountsByBillingAccountNamesImpl(this); - } - return this.enrollmentAccountsByBillingAccountNames; - } - /** * @return Entry point to manage EnrollmentAccounts. */ @@ -272,36 +182,6 @@ public EnrollmentAccounts enrollmentAccounts() { return this.enrollmentAccounts; } - /** - * @return Entry point to manage InvoicesByBillingAccounts. - */ - public InvoicesByBillingAccounts invoicesByBillingAccounts() { - if (this.invoicesByBillingAccounts == null) { - this.invoicesByBillingAccounts = new InvoicesByBillingAccountsImpl(this); - } - return this.invoicesByBillingAccounts; - } - - /** - * @return Entry point to manage InvoicePricesheets. - */ - public InvoicePricesheets invoicePricesheets() { - if (this.invoicePricesheets == null) { - this.invoicePricesheets = new InvoicePricesheetsImpl(this); - } - return this.invoicePricesheets; - } - - /** - * @return Entry point to manage InvoicesByBillingProfiles. - */ - public InvoicesByBillingProfiles invoicesByBillingProfiles() { - if (this.invoicesByBillingProfiles == null) { - this.invoicesByBillingProfiles = new InvoicesByBillingProfilesImpl(this); - } - return this.invoicesByBillingProfiles; - } - /** * @return Entry point to manage Invoices. */ @@ -313,33 +193,13 @@ public Invoices invoices() { } /** - * @return Entry point to manage ProductsByBillingSubscriptions. - */ - public ProductsByBillingSubscriptions productsByBillingSubscriptions() { - if (this.productsByBillingSubscriptions == null) { - this.productsByBillingSubscriptions = new ProductsByBillingSubscriptionsImpl(this); - } - return this.productsByBillingSubscriptions; - } - - /** - * @return Entry point to manage BillingSubscriptionsByBillingProfiles. - */ - public BillingSubscriptionsByBillingProfiles billingSubscriptionsByBillingProfiles() { - if (this.billingSubscriptionsByBillingProfiles == null) { - this.billingSubscriptionsByBillingProfiles = new BillingSubscriptionsByBillingProfilesImpl(this); - } - return this.billingSubscriptionsByBillingProfiles; - } - - /** - * @return Entry point to manage BillingSubscriptionsByInvoiceSections. + * @return Entry point to manage PriceSheets. */ - public BillingSubscriptionsByInvoiceSections billingSubscriptionsByInvoiceSections() { - if (this.billingSubscriptionsByInvoiceSections == null) { - this.billingSubscriptionsByInvoiceSections = new BillingSubscriptionsByInvoiceSectionsImpl(this); + public PriceSheets priceSheets() { + if (this.priceSheets == null) { + this.priceSheets = new PriceSheetsImpl(this); } - return this.billingSubscriptionsByInvoiceSections; + return this.priceSheets; } /** @@ -352,26 +212,6 @@ public BillingSubscriptions billingSubscriptions() { return this.billingSubscriptions; } - /** - * @return Entry point to manage ProductsByBillingAccounts. - */ - public ProductsByBillingAccounts productsByBillingAccounts() { - if (this.productsByBillingAccounts == null) { - this.productsByBillingAccounts = new ProductsByBillingAccountsImpl(this); - } - return this.productsByBillingAccounts; - } - - /** - * @return Entry point to manage ProductsByInvoiceSections. - */ - public ProductsByInvoiceSections productsByInvoiceSections() { - if (this.productsByInvoiceSections == null) { - this.productsByInvoiceSections = new ProductsByInvoiceSectionsImpl(this); - } - return this.productsByInvoiceSections; - } - /** * @return Entry point to manage Products. */ @@ -383,43 +223,23 @@ public Products products() { } /** - * @return Entry point to manage TransactionsByBillingAccounts. + * @return Entry point to manage Transactions. */ - public TransactionsByBillingAccounts transactionsByBillingAccounts() { - if (this.transactionsByBillingAccounts == null) { - this.transactionsByBillingAccounts = new TransactionsByBillingAccountsImpl(this); + public Transactions transactions() { + if (this.transactions == null) { + this.transactions = new TransactionsImpl(this); } - return this.transactionsByBillingAccounts; + return this.transactions; } /** - * @return Entry point to manage TransactionsByBillingProfiles. + * @return Entry point to manage Policies. */ - public TransactionsByBillingProfiles transactionsByBillingProfiles() { - if (this.transactionsByBillingProfiles == null) { - this.transactionsByBillingProfiles = new TransactionsByBillingProfilesImpl(this); + public Policies policies() { + if (this.policies == null) { + this.policies = new PoliciesImpl(this); } - return this.transactionsByBillingProfiles; - } - - /** - * @return Entry point to manage TransactionsByInvoiceSections. - */ - public TransactionsByInvoiceSections transactionsByInvoiceSections() { - if (this.transactionsByInvoiceSections == null) { - this.transactionsByInvoiceSections = new TransactionsByInvoiceSectionsImpl(this); - } - return this.transactionsByInvoiceSections; - } - - /** - * @return Entry point to manage Policys. - */ - public Policys policys() { - if (this.policys == null) { - this.policys = new PolicysImpl(this); - } - return this.policys; + return this.policies; } /** @@ -463,93 +283,33 @@ public Operations operations() { } /** - * @return Entry point to manage BillingAccountBillingPermissions. - */ - public BillingAccountBillingPermissions billingAccountBillingPermissions() { - if (this.billingAccountBillingPermissions == null) { - this.billingAccountBillingPermissions = new BillingAccountBillingPermissionsImpl(this); - } - return this.billingAccountBillingPermissions; - } - - /** - * @return Entry point to manage InvoiceSectionsBillingPermissions. - */ - public InvoiceSectionsBillingPermissions invoiceSectionsBillingPermissions() { - if (this.invoiceSectionsBillingPermissions == null) { - this.invoiceSectionsBillingPermissions = new InvoiceSectionsBillingPermissionsImpl(this); - } - return this.invoiceSectionsBillingPermissions; - } - - /** - * @return Entry point to manage BillingProfileBillingPermissions. - */ - public BillingProfileBillingPermissions billingProfileBillingPermissions() { - if (this.billingProfileBillingPermissions == null) { - this.billingProfileBillingPermissions = new BillingProfileBillingPermissionsImpl(this); - } - return this.billingProfileBillingPermissions; - } - - /** - * @return Entry point to manage BillingAccountBillingRoleDefinitions. - */ - public BillingAccountBillingRoleDefinitions billingAccountBillingRoleDefinitions() { - if (this.billingAccountBillingRoleDefinitions == null) { - this.billingAccountBillingRoleDefinitions = new BillingAccountBillingRoleDefinitionsImpl(this); - } - return this.billingAccountBillingRoleDefinitions; - } - - /** - * @return Entry point to manage InvoiceSectionBillingRoleDefinitions. - */ - public InvoiceSectionBillingRoleDefinitions invoiceSectionBillingRoleDefinitions() { - if (this.invoiceSectionBillingRoleDefinitions == null) { - this.invoiceSectionBillingRoleDefinitions = new InvoiceSectionBillingRoleDefinitionsImpl(this); - } - return this.invoiceSectionBillingRoleDefinitions; - } - - /** - * @return Entry point to manage BillingProfileBillingRoleDefinitions. - */ - public BillingProfileBillingRoleDefinitions billingProfileBillingRoleDefinitions() { - if (this.billingProfileBillingRoleDefinitions == null) { - this.billingProfileBillingRoleDefinitions = new BillingProfileBillingRoleDefinitionsImpl(this); - } - return this.billingProfileBillingRoleDefinitions; - } - - /** - * @return Entry point to manage BillingAccountBillingRoleAssignments. + * @return Entry point to manage BillingPermissions. */ - public BillingAccountBillingRoleAssignments billingAccountBillingRoleAssignments() { - if (this.billingAccountBillingRoleAssignments == null) { - this.billingAccountBillingRoleAssignments = new BillingAccountBillingRoleAssignmentsImpl(this); + public BillingPermissions billingPermissions() { + if (this.billingPermissions == null) { + this.billingPermissions = new BillingPermissionsImpl(this); } - return this.billingAccountBillingRoleAssignments; + return this.billingPermissions; } /** - * @return Entry point to manage InvoiceSectionBillingRoleAssignments. + * @return Entry point to manage BillingRoleDefinitions. */ - public InvoiceSectionBillingRoleAssignments invoiceSectionBillingRoleAssignments() { - if (this.invoiceSectionBillingRoleAssignments == null) { - this.invoiceSectionBillingRoleAssignments = new InvoiceSectionBillingRoleAssignmentsImpl(this); + public BillingRoleDefinitions billingRoleDefinitions() { + if (this.billingRoleDefinitions == null) { + this.billingRoleDefinitions = new BillingRoleDefinitionsImpl(this); } - return this.invoiceSectionBillingRoleAssignments; + return this.billingRoleDefinitions; } /** - * @return Entry point to manage BillingProfileBillingRoleAssignments. + * @return Entry point to manage BillingRoleAssignments. */ - public BillingProfileBillingRoleAssignments billingProfileBillingRoleAssignments() { - if (this.billingProfileBillingRoleAssignments == null) { - this.billingProfileBillingRoleAssignments = new BillingProfileBillingRoleAssignmentsImpl(this); + public BillingRoleAssignments billingRoleAssignments() { + if (this.billingRoleAssignments == null) { + this.billingRoleAssignments = new BillingRoleAssignmentsImpl(this); } - return this.billingProfileBillingRoleAssignments; + return this.billingRoleAssignments; } /** diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsImpl.java new file mode 100644 index 0000000000000..186d148278da1 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsImpl.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissionsListResult; + +class BillingPermissionsImpl extends WrapperImpl implements BillingPermissions { + private final BillingManager manager; + + BillingPermissionsImpl(BillingManager manager) { + super(manager.inner().billingPermissions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable listByBillingAccountAsync(String billingAccountName) { + BillingPermissionsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .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(); + return client.listByInvoiceSectionsAsync(billingAccountName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { + return new BillingPermissionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + BillingPermissionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { + return new BillingPermissionsListResultImpl(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/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 new file mode 100644 index 0000000000000..50c5a11a5be8c --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsInner.java @@ -0,0 +1,310 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingPermissions. + */ +public class BillingPermissionsInner { + /** The Retrofit service to perform REST calls. */ + private BillingPermissionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingPermissionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingPermissionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingPermissionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingPermissions to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingPermissionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions listByBillingAccount" }) + @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 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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingPermissions") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all billing permissions for the caller under a billing account. + * + * @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 BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByBillingAccount(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists all billing permissions for the caller under a billing account. + * + * @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 listByBillingAccountAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Lists all billing permissions for the caller under a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable listByBillingAccountAsync(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all billing permissions for the caller under a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable> listByBillingAccountWithServiceResponseAsync(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."); + } + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountDelegate(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 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 BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByInvoiceSections(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionsWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Lists all billing permissions for the caller under invoice section. + * + * @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 listByInvoiceSectionsAsync(String billingAccountName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByInvoiceSectionsWithServiceResponseAsync(billingAccountName, invoiceSectionName), serviceCallback); + } + + /** + * Lists all billing permissions for the caller under invoice section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable listByInvoiceSectionsAsync(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionsWithServiceResponseAsync(billingAccountName, invoiceSectionName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all billing permissions for the caller under invoice section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable> listByInvoiceSectionsWithServiceResponseAsync(String billingAccountName, 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInvoiceSections(billingAccountName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByInvoiceSectionsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByInvoiceSectionsDelegate(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 billingPermissions for the caller has for a billing account. + * + * @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 BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByBillingProfile(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists all billingPermissions for the caller has for a billing account. + * + * @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 listByBillingProfileAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * Lists all billingPermissions for the caller has for a billing account. + * + * @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 + */ + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all billingPermissions for the caller has for a billing account. + * + * @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 + */ + public Observable> listByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName 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.listByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultImpl.java index bf137d5e31108..89047f4753f7a 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultImpl.java @@ -11,7 +11,7 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissionsListResult; import com.microsoft.azure.arm.model.implementation.WrapperImpl; import java.util.List; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissionsProperties; class BillingPermissionsListResultImpl extends WrapperImpl implements BillingPermissionsListResult { private final BillingManager manager; @@ -26,7 +26,7 @@ public BillingManager manager() { } @Override - public List value() { + 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/BillingPermissionsListResultInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultInner.java index a63975b6e186e..48a64cbdf9d6b 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultInner.java @@ -9,7 +9,7 @@ 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.BillingPermissions; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissionsProperties; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -20,14 +20,14 @@ public class BillingPermissionsListResultInner { * The list OF billingPermissions a caller has on a billing account. */ @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) - private List value; + private List value; /** * Get the list OF billingPermissions a caller has on a billing account. * * @return the value value */ - public List value() { + public List value() { return this.value; } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesImpl.java index 6cf355e9f0bd3..077ce1dd1cdad 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesImpl.java @@ -13,6 +13,7 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfiles; import rx.Observable; import rx.functions.Func1; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfileListResult; import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfile; class BillingProfilesImpl extends WrapperImpl implements BillingProfiles { @@ -31,6 +32,18 @@ private BillingProfileImpl wrapModel(BillingProfileInner inner) { return new BillingProfileImpl(inner, manager()); } + @Override + public Observable listByBillingAccountNameAsync(String billingAccountName) { + BillingProfilesInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingProfileListResult call(BillingProfileListResultInner inner) { + return new BillingProfileListResultImpl(inner, manager()); + } + }); + } + @Override public Observable getAsync(String billingAccountName, String billingProfileName) { BillingProfilesInner 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/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 fca2f19ad394b..f63b04214d70e 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 @@ -56,6 +56,10 @@ public BillingProfilesInner(Retrofit retrofit, BillingManagementClientImpl clien * used by Retrofit to perform actually REST calls. */ interface BillingProfilesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfiles listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @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.BillingProfiles get" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -70,6 +74,156 @@ interface BillingProfilesService { } + /** + * 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 + * @throws ErrorResponseException 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. + */ + public BillingProfileListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @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); + } + + /** + * 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 BillingProfileListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, BillingProfileListResultInner>() { + @Override + public BillingProfileListResultInner 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 BillingProfileListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(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 expand = null; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @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. + */ + public BillingProfileListResultInner listByBillingAccountName(String billingAccountName, String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand).toBlocking().single().body(); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @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); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @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 + */ + public Observable listByBillingAccountNameAsync(String billingAccountName, String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand).map(new Func1, BillingProfileListResultInner>() { + @Override + public BillingProfileListResultInner 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 expand May be used to expand the invoiceSections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand) { + 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(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * Get the billing profile by id. * diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsImpl.java new file mode 100644 index 0000000000000..8214dc9c7dbea --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsImpl.java @@ -0,0 +1,175 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignment; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignmentListResult; + +class BillingRoleAssignmentsImpl extends WrapperImpl implements BillingRoleAssignments { + private final BillingManager manager; + + BillingRoleAssignmentsImpl(BillingManager manager) { + super(manager.inner().billingRoleAssignments()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByBillingAccountAsync(billingAccountName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByBillingAccountNameAsync(String billingAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByBillingAccountNameAsync(billingAccountName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountNameAsync(String billingAccountName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable addByBillingAccountNameAsync(String billingAccountName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.addByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable addByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.addByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable addByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.addByBillingProfileNameAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(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/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 new file mode 100644 index 0000000000000..843da1e973969 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsInner.java @@ -0,0 +1,1118 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.management.billing.v2018_11_01_preview.BillingRoleAssignmentPayload; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingRoleAssignments. + */ +public class BillingRoleAssignmentsInner { + /** The Retrofit service to perform REST calls. */ + private BillingRoleAssignmentsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingRoleAssignmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingRoleAssignmentsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingRoleAssignmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingRoleAssignments to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingRoleAssignmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments getByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByBillingAccount(@Path("billingAccountName") String billingAccountName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @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.BillingRoleAssignments deleteByBillingAccountName" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @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.BillingRoleAssignments getByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @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.BillingRoleAssignments deleteByInvoiceSectionName" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @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.BillingRoleAssignments getByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @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.BillingRoleAssignments deleteByBillingProfileName" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @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.BillingRoleAssignments listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments") + Observable> listByBillingAccountName(@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.BillingRoleAssignments addByBillingAccountName" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/createBillingRoleAssignment") + Observable> addByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BillingRoleAssignmentPayload parameters, @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.BillingRoleAssignments listByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments") + 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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments addByInvoiceSectionName" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/createBillingRoleAssignment") + Observable> addByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BillingRoleAssignmentPayload parameters, @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.BillingRoleAssignments listByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments") + 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.BillingRoleAssignments addByBillingProfileName" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/createBillingRoleAssignment") + Observable> addByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body BillingRoleAssignmentPayload parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Get the role assignment for the caller. + * + * @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 + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByBillingAccount(String billingAccountName, String billingRoleAssignmentName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Get the role assignment for the caller. + * + * @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 + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Get the role assignment for the caller. + * + * @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 + */ + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignment for the caller. + * + * @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 + */ + public Observable> getByBillingAccountWithServiceResponseAsync(String billingAccountName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingAccount(billingAccountName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete the role assignment on this billing account. + * + * @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 + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner deleteByBillingAccountName(String billingAccountName, String billingRoleAssignmentName) { + return deleteByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Delete the role assignment on this billing account. + * + * @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 + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteByBillingAccountNameAsync(String billingAccountName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Delete the role assignment on this billing account. + * + * @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 + */ + public Observable deleteByBillingAccountNameAsync(String billingAccountName, String billingRoleAssignmentName) { + return deleteByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete the role assignment on this billing account. + * + * @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 + */ + public Observable> deleteByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName 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.deleteByBillingAccountName(billingAccountName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the role assignment for the caller on the invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment 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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + return getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Get the role assignment for the caller on the invoice Section. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Get the role assignment for the caller on the invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + return getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignment for the caller on the invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> getByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + 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 (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName 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.getByInvoiceSectionName(billingAccountName, invoiceSectionName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByInvoiceSectionNameDelegate(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); + } + + /** + * Delete the role assignment on the invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment 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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner deleteByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + return deleteByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Delete the role assignment on the invoice Section. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Delete the role assignment on the invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable deleteByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + return deleteByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete the role assignment on the invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> deleteByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + 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 (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName 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.deleteByInvoiceSectionName(billingAccountName, invoiceSectionName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the role assignment for the caller on the Billing Profile. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment 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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByBillingProfileName(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Get the role assignment for the caller on the Billing Profile. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Get the role assignment for the caller on the Billing Profile. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignment for the caller on the Billing Profile. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> getByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName 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.getByBillingProfileName(billingAccountName, billingProfileName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileNameDelegate(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); + } + + /** + * Delete the role assignment on this Billing Profile. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment 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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner deleteByBillingProfileName(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return deleteByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Delete the role assignment on this Billing Profile. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Delete the role assignment on this Billing Profile. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable deleteByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return deleteByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete the role assignment on this Billing Profile. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> deleteByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName 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.deleteByBillingProfileName(billingAccountName, billingProfileName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the role assignments on the Billing Account. + * + * @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 BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Get the role assignments on the Billing Account. + * + * @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); + } + + /** + * Get the role assignments on the Billing Account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignments on the Billing Account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(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."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to add a role assignment to a billing account. + * + * @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 BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner addByBillingAccountName(String billingAccountName) { + return addByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * The operation to add a role assignment to a billing account. + * + * @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 addByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * The operation to add a role assignment to a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable addByBillingAccountNameAsync(String billingAccountName) { + return addByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to add a role assignment to a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> addByBillingAccountNameWithServiceResponseAsync(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."); + } + return service.addByBillingAccountName(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the role assignments on the invoice Section. + * + * @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 BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Get the role assignments on the invoice Section. + * + * @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); + } + + /** + * Get the role assignments on the invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignments on the invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, 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 (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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to add a role assignment to a invoice Section. + * + * @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 BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner addByInvoiceSectionName(String billingAccountName, String invoiceSectionName) { + return addByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * The operation to add a role assignment to a invoice Section. + * + * @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 addByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName), serviceCallback); + } + + /** + * The operation to add a role assignment to a invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable addByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + return addByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to add a role assignment to a invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> addByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.addByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the role assignments on the Billing Profile. + * + * @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 BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner listByBillingProfileName(String billingAccountName, String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Get the role assignments on the Billing Profile. + * + * @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); + } + + /** + * Get the role assignments on the Billing Profile. + * + * @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 + */ + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignments on the Billing Profile. + * + * @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 + */ + public Observable> listByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName 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.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to add a role assignment to a billing profile. + * + * @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 BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner addByBillingProfileName(String billingAccountName, String billingProfileName) { + return addByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * The operation to add a role assignment to a billing profile. + * + * @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 addByBillingProfileNameAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * The operation to add a role assignment to a billing profile. + * + * @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 + */ + public Observable addByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + return addByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to add a role assignment to a billing profile. + * + * @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 + */ + public Observable> addByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName 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.addByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, 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/BillingRoleDefinitionImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionImpl.java index b25a60d749c25..a2d1316b07bb8 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionImpl.java @@ -11,7 +11,7 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinition; import com.microsoft.azure.arm.model.implementation.WrapperImpl; import java.util.List; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissionsProperties; class BillingRoleDefinitionImpl extends WrapperImpl implements BillingRoleDefinition { private final BillingManager manager; @@ -51,7 +51,7 @@ public String type() { } @Override - public List value() { + 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/BillingRoleDefinitionInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionInner.java index e3e62d2a4dcee..12e6f5917d9a7 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionInner.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionInner.java @@ -9,7 +9,7 @@ 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.BillingPermissions; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissionsProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.ProxyResource; @@ -29,7 +29,7 @@ public class BillingRoleDefinitionInner extends ProxyResource { * The list OF billingPermissions a caller has on a billing account. */ @JsonProperty(value = "properties.permissions.value", access = JsonProperty.Access.WRITE_ONLY) - private List value; + private List value; /** * The name of the role. @@ -51,7 +51,7 @@ public String description() { * * @return the value value */ - public List value() { + public List value() { return this.value; } diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsImpl.java new file mode 100644 index 0000000000000..741e82582a45c --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsImpl.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinition; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitionListResult; + +class BillingRoleDefinitionsImpl extends WrapperImpl implements BillingRoleDefinitions { + private final BillingManager manager; + + BillingRoleDefinitionsImpl(BillingManager manager) { + super(manager.inner().billingRoleDefinitions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getByBillingAccountNameAsync(String billingAccountName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByBillingAccountNameAsync(billingAccountName, billingRoleDefinitionName) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleDefinitionName) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountNameAsync(String billingAccountName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingRoleDefinitionListResult call(BillingRoleDefinitionListResultInner inner) { + return new BillingRoleDefinitionListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingRoleDefinitionListResult call(BillingRoleDefinitionListResultInner inner) { + return new BillingRoleDefinitionListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingRoleDefinitionListResult call(BillingRoleDefinitionListResultInner inner) { + return new BillingRoleDefinitionListResultImpl(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/BillingRoleDefinitionsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsInner.java new file mode 100644 index 0000000000000..4177e5142a4c0 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsInner.java @@ -0,0 +1,585 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingRoleDefinitions. + */ +public class BillingRoleDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private BillingRoleDefinitionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingRoleDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingRoleDefinitionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingRoleDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingRoleDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingRoleDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions getByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Path("billingRoleDefinitionName") String billingRoleDefinitionName, @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.BillingRoleDefinitions getByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleDefinitionName") String billingRoleDefinitionName, @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.BillingRoleDefinitions getByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("billingRoleDefinitionName") String billingRoleDefinitionName, @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.BillingRoleDefinitions listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions") + Observable> listByBillingAccountName(@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.BillingRoleDefinitions listByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions") + 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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions listByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions") + 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); + + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName billing Account Id. + * @param billingRoleDefinitionName role definition 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 BillingRoleDefinitionInner object if successful. + */ + public BillingRoleDefinitionInner getByBillingAccountName(String billingAccountName, String billingRoleDefinitionName) { + return getByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName billing Account Id. + * @param billingRoleDefinitionName role definition 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 getByBillingAccountNameAsync(String billingAccountName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the role definition for a role. + * + * @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 + */ + public Observable getByBillingAccountNameAsync(String billingAccountName, String billingRoleDefinitionName) { + return getByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the role definition for a role. + * + * @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 + */ + public Observable> getByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName 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.getByBillingAccountName(billingAccountName, billingRoleDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleDefinitionName role definition 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 BillingRoleDefinitionInner object if successful. + */ + public BillingRoleDefinitionInner getByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName) { + return getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the role definition for a role. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName) { + return getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable> getByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName) { + 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 (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName 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.getByInvoiceSectionName(billingAccountName, invoiceSectionName, billingRoleDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleDefinitionName role definition 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 BillingRoleDefinitionInner object if successful. + */ + public BillingRoleDefinitionInner getByBillingProfileName(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the role definition for a role. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable> getByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName 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.getByBillingProfileName(billingAccountName, billingProfileName, billingRoleDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definition for a billing account. + * + * @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 BillingRoleDefinitionListResultInner object if successful. + */ + public BillingRoleDefinitionListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists the role definition for a billing account. + * + * @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); + } + + /** + * Lists the role definition for a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, BillingRoleDefinitionListResultInner>() { + @Override + public BillingRoleDefinitionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the role definition for a billing account. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(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."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definition for an invoice Section. + * + * @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 BillingRoleDefinitionListResultInner object if successful. + */ + public BillingRoleDefinitionListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Lists the role definition for an invoice Section. + * + * @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); + } + + /** + * Lists the role definition for an invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).map(new Func1, BillingRoleDefinitionListResultInner>() { + @Override + public BillingRoleDefinitionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the role definition for an invoice Section. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, 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 (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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definition for a Billing Profile. + * + * @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 BillingRoleDefinitionListResultInner object if successful. + */ + public BillingRoleDefinitionListResultInner listByBillingProfileName(String billingAccountName, String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists the role definition for a Billing Profile. + * + * @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); + } + + /** + * Lists the role definition for a Billing Profile. + * + * @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 + */ + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingRoleDefinitionListResultInner>() { + @Override + public BillingRoleDefinitionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the role definition for a Billing Profile. + * + * @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 + */ + public Observable> listByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName 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.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionSummaryImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionSummaryImpl.java new file mode 100644 index 0000000000000..6725462d104db --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionSummaryImpl.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingSubscriptionSummary; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionStatusType; +import java.util.UUID; + +class BillingSubscriptionSummaryImpl extends WrapperImpl implements BillingSubscriptionSummary { + private final BillingManager manager; + + BillingSubscriptionSummaryImpl(BillingSubscriptionSummaryInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String billingProfileName() { + return this.inner().billingProfileName(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public String invoiceSectionName() { + return this.inner().invoiceSectionName(); + } + + @Override + public Amount lastMonthCharges() { + return this.inner().lastMonthCharges(); + } + + @Override + public Amount monthToDateCharges() { + return this.inner().monthToDateCharges(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String skuDescription() { + return this.inner().skuDescription(); + } + + @Override + public String skuId() { + return this.inner().skuId(); + } + + @Override + public BillingSubscriptionStatusType subscriptionBillingStatus() { + return this.inner().subscriptionBillingStatus(); + } + + @Override + public UUID subscriptionId() { + return this.inner().subscriptionId(); + } + + @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/BillingSubscriptionsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsImpl.java index 980d649d53584..0bbf3d2a3bff5 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsImpl.java @@ -13,8 +13,10 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions; import rx.Observable; import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionsListResult; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionSummary; import com.microsoft.azure.management.billing.v2018_11_01_preview.TransferBillingSubscriptionResult; -import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionBillingAccountBillingSubscriptionSummary; class BillingSubscriptionsImpl extends WrapperImpl implements BillingSubscriptions { private final BillingManager manager; @@ -28,8 +30,44 @@ public BillingManager manager() { return this.manager; } - private InvoiceSectionBillingAccountBillingSubscriptionSummaryImpl wrapModel(BillingSubscriptionSummaryInner inner) { - return new InvoiceSectionBillingAccountBillingSubscriptionSummaryImpl(inner, manager()); + private BillingSubscriptionSummaryImpl wrapModel(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); + } + + @Override + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingSubscriptionsListResult call(BillingSubscriptionsListResultInner inner) { + return new BillingSubscriptionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingSubscriptionsListResult call(BillingSubscriptionsListResultInner inner) { + return new BillingSubscriptionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + BillingSubscriptionsInner client = this.inner(); + return client.getAsync(billingAccountName, invoiceSectionName, billingSubscriptionName) + .map(new Func1() { + @Override + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); + } + }); } @Override @@ -45,15 +83,21 @@ public TransferBillingSubscriptionResult call(TransferBillingSubscriptionResultI } @Override - public Observable getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + public Observable listByBillingAccountNameAsync(final String billingAccountName) { BillingSubscriptionsInner client = this.inner(); - return client.getAsync(billingAccountName, invoiceSectionName, billingSubscriptionName) - .map(new Func1() { + return client.listByBillingAccountNameAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { @Override - public InvoiceSectionBillingAccountBillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner 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/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 a6f0a3d60faf4..a9a695f556dcb 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 @@ -10,14 +10,19 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionTransferHeaders; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionsTransferHeaders; import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; import com.microsoft.azure.management.billing.v2018_11_01_preview.TransferBillingSubscriptionRequestProperties; +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 java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; @@ -26,6 +31,7 @@ import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -56,6 +62,18 @@ public BillingSubscriptionsInner(Retrofit retrofit, BillingManagementClientImpl * used by Retrofit to perform actually REST calls. */ interface BillingSubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions") + Observable> listByBillingAccountName(@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.BillingSubscriptions listByBillingProfileName" }) + @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 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); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions get" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}") Observable> get(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingSubscriptionName") String billingSubscriptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -68,6 +86,288 @@ interface BillingSubscriptionsService { @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer") Observable> beginTransfer(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingSubscriptionName") String billingSubscriptionName, @Header("accept-language") String acceptLanguage, @Body TransferBillingSubscriptionRequestProperties parameters, @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 listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 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 billing subscriptions by billing account name. + * + * @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 billing subscriptions by billing account name. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscriptions by billing account name. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> 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 billing subscriptions by billing account name. + * + 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. + */ + 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."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), 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); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @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. + */ + public BillingSubscriptionsListResultInner listByBillingProfileName(String billingAccountName, String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @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); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @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 + */ + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingSubscriptionsListResultInner>() { + @Override + public BillingSubscriptionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @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 + */ + public Observable> listByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName 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.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileNameDelegate(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 billing subscription by invoice section name. + * + * @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 BillingSubscriptionsListResultInner object if successful. + */ + public BillingSubscriptionsListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Lists billing subscription by invoice section name. + * + * @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); + } + + /** + * Lists billing subscription 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 BillingSubscriptionsListResultInner 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(); + } + }); + } + + /** + * Lists billing subscription 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 BillingSubscriptionsListResultInner object + */ + public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, 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 (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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByInvoiceSectionNameDelegate(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); } /** @@ -161,7 +461,7 @@ private ServiceResponse getDelegate(Response transferAsync(Strin } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -199,16 +499,16 @@ public ServiceFuture transferAsync(Strin * @return the observable for the request */ public Observable transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { - return transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).map(new Func1, TransferBillingSubscriptionResultInner>() { + return transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).map(new Func1, TransferBillingSubscriptionResultInner>() { @Override - public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { + public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { return response.body(); } }); } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -216,7 +516,7 @@ public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders> transferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + public Observable> transferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -230,10 +530,10 @@ public Observable> observable = service.transfer(billingAccountName, invoiceSectionName, billingSubscriptionName, this.client.acceptLanguage(), parameters, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingSubscriptionTransferHeaders.class); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingSubscriptionsTransferHeaders.class); } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -249,7 +549,7 @@ public TransferBillingSubscriptionResultInner transfer(String billingAccountName } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -264,7 +564,7 @@ public ServiceFuture transferAsync(Strin } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -274,16 +574,16 @@ public ServiceFuture transferAsync(Strin * @return the observable for the request */ public Observable transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, String destinationInvoiceSectionId) { - return transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, destinationInvoiceSectionId).map(new Func1, TransferBillingSubscriptionResultInner>() { + return transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, destinationInvoiceSectionId).map(new Func1, TransferBillingSubscriptionResultInner>() { @Override - public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { + public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { return response.body(); } }); } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -292,7 +592,7 @@ public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders> transferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, String destinationInvoiceSectionId) { + public Observable> transferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, String destinationInvoiceSectionId) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -305,11 +605,11 @@ public Observable> observable = service.transfer(billingAccountName, invoiceSectionName, billingSubscriptionName, this.client.acceptLanguage(), parameters, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingSubscriptionTransferHeaders.class); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingSubscriptionsTransferHeaders.class); } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -324,7 +624,7 @@ public TransferBillingSubscriptionResultInner beginTransfer(String billingAccoun } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -338,7 +638,7 @@ public ServiceFuture beginTransferAsync( } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -347,16 +647,16 @@ public ServiceFuture beginTransferAsync( * @return the observable to the TransferBillingSubscriptionResultInner object */ public Observable beginTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { - return beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).map(new Func1, TransferBillingSubscriptionResultInner>() { + return beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).map(new Func1, TransferBillingSubscriptionResultInner>() { @Override - public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { + public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { return response.body(); } }); } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -364,7 +664,7 @@ public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders> beginTransferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + public Observable> beginTransferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -378,11 +678,11 @@ public Observable, Observable>>() { + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponseWithHeaders clientResponse = beginTransferDelegate(response); + ServiceResponseWithHeaders clientResponse = beginTransferDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -392,7 +692,7 @@ public Observable beginTransferAsync( } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -433,16 +733,16 @@ public ServiceFuture beginTransferAsync( * @return the observable to the TransferBillingSubscriptionResultInner object */ public Observable beginTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, String destinationInvoiceSectionId) { - return beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, destinationInvoiceSectionId).map(new Func1, TransferBillingSubscriptionResultInner>() { + return beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, destinationInvoiceSectionId).map(new Func1, TransferBillingSubscriptionResultInner>() { @Override - public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { + public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { return response.body(); } }); } /** - * Transfers the GTM subscription from one invoice section to another within a billing account. + * Transfers the subscription from one invoice section to another within a billing account. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -451,7 +751,7 @@ public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders> beginTransferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, String destinationInvoiceSectionId) { + public Observable> beginTransferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, String destinationInvoiceSectionId) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -464,11 +764,11 @@ public Observable, Observable>>() { + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponseWithHeaders clientResponse = beginTransferDelegate(response); + ServiceResponseWithHeaders clientResponse = beginTransferDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -477,12 +777,123 @@ public Observable beginTransferDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + private ServiceResponseWithHeaders beginTransferDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .register(202, new TypeToken() { }.getType()) .registerError(ErrorResponseException.class) - .buildWithHeaders(response, BillingSubscriptionTransferHeaders.class); + .buildWithHeaders(response, BillingSubscriptionsTransferHeaders.class); + } + + /** + * Lists billing subscriptions by billing account 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 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 billing subscriptions by billing account 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> 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 billing subscriptions by billing account 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> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscriptions by billing account 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>> 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 billing subscriptions by billing account 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>> 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 c9372132f1884..65c94d44eccf1 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,6 +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.management.billing.v2018_11_01_preview.Department; class DepartmentsImpl extends WrapperImpl implements Departments { @@ -31,6 +32,18 @@ private DepartmentImpl wrapModel(DepartmentInner inner) { return new DepartmentImpl(inner, manager()); } + @Override + public Observable listByBillingAccountNameAsync(String billingAccountName) { + DepartmentsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public DepartmentListResult call(DepartmentListResultInner inner) { + return new DepartmentListResultImpl(inner, manager()); + } + }); + } + @Override public Observable getAsync(String billingAccountName, String departmentName) { DepartmentsInner 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/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 0170e0236ad3c..a95cb9677e36d 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 @@ -51,12 +51,171 @@ public DepartmentsInner(Retrofit retrofit, BillingManagementClientImpl client) { * used by Retrofit to perform actually REST calls. */ interface DepartmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Departments listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @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 get" }) @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); } + /** + * Lists all departments for a user which he has access to. + * + * @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. + */ + public DepartmentListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists all departments for a user which he has access to. + * + * @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); + } + + /** + * Lists all departments for a user which he has access to. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DepartmentListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, DepartmentListResultInner>() { + @Override + public DepartmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all departments for a user which he has access to. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DepartmentListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(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 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all departments for a user which he has access to. + * + * @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 + * @throws ErrorResponseException 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. + */ + public DepartmentListResultInner listByBillingAccountName(String billingAccountName, String expand, String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).toBlocking().single().body(); + } + + /** + * Lists all departments for a user which he has access to. + * + * @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); + } + + /** + * Lists all departments for a user which he has access to. + * + * @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 + */ + 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(); + } + }); + } + + /** + * Lists all departments for a user which he has access to. + * + * @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 + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand, String filter) { + 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(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * Get the department by id. * diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountImpl.java index a68596fa29867..317801e85d8ea 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountImpl.java @@ -35,7 +35,7 @@ public BillingManager manager() { @Override protected Observable getInnerAsync() { EnrollmentAccountsInner client = this.manager().inner().enrollmentAccounts(); - return client.getByEnrollmentAccountAccountIdAsync(this.billingAccountName, this.enrollmentAccountName); + return client.getByEnrollmentAccountIdAsync(this.billingAccountName, this.enrollmentAccountName); } 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 72dd8c439b08f..acb50bb0905d4 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,6 +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.management.billing.v2018_11_01_preview.EnrollmentAccount; class EnrollmentAccountsImpl extends WrapperImpl implements EnrollmentAccounts { @@ -32,9 +33,21 @@ private EnrollmentAccountImpl wrapModel(EnrollmentAccountInner inner) { } @Override - public Observable getByEnrollmentAccountAccountIdAsync(String billingAccountName, String enrollmentAccountName) { + public Observable listByBillingAccountNameAsync(String billingAccountName) { EnrollmentAccountsInner client = this.inner(); - return client.getByEnrollmentAccountAccountIdAsync(billingAccountName, enrollmentAccountName) + return client.listByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public EnrollmentAccountListResult call(EnrollmentAccountListResultInner inner) { + return new EnrollmentAccountListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName) { + EnrollmentAccountsInner client = this.inner(); + return client.getByEnrollmentAccountIdAsync(billingAccountName, enrollmentAccountName) .map(new Func1() { @Override public EnrollmentAccount call(EnrollmentAccountInner 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 afc7951d1ff9c..beda2f6272b56 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 @@ -51,10 +51,169 @@ public EnrollmentAccountsInner(Retrofit retrofit, BillingManagementClientImpl cl * used by Retrofit to perform actually REST calls. */ interface EnrollmentAccountsService { - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccounts getByEnrollmentAccountAccountId" }) + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccounts listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @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 getByEnrollmentAccountId" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}") - Observable> getByEnrollmentAccountAccountId(@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); + 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); + + } + + /** + * Lists all Enrollment Accounts for a user which he has access to. + * + * @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. + */ + public EnrollmentAccountListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists all Enrollment Accounts for a user which he has access to. + * + * @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); + } + + /** + * Lists all Enrollment Accounts for a user which he has access to. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnrollmentAccountListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, EnrollmentAccountListResultInner>() { + @Override + public EnrollmentAccountListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all Enrollment Accounts for a user which he has access to. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnrollmentAccountListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(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 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + /** + * Lists all Enrollment Accounts for a user which he has access to. + * + * @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. + */ + public EnrollmentAccountListResultInner listByBillingAccountName(String billingAccountName, String expand, String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).toBlocking().single().body(); + } + + /** + * Lists all Enrollment Accounts for a user which he has access to. + * + * @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); + } + + /** + * Lists all Enrollment Accounts for a user which he has access to. + * + * @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 + */ + 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(); + } + }); + } + + /** + * Lists all Enrollment Accounts for a user which he has access to. + * + * @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 + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand, String filter) { + 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(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(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); } /** @@ -67,8 +226,8 @@ interface EnrollmentAccountsService { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the EnrollmentAccountInner object if successful. */ - public EnrollmentAccountInner getByEnrollmentAccountAccountId(String billingAccountName, String enrollmentAccountName) { - return getByEnrollmentAccountAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName).toBlocking().single().body(); + public EnrollmentAccountInner getByEnrollmentAccountId(String billingAccountName, String enrollmentAccountName) { + return getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName).toBlocking().single().body(); } /** @@ -80,8 +239,8 @@ public EnrollmentAccountInner getByEnrollmentAccountAccountId(String billingAcco * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getByEnrollmentAccountAccountIdAsync(String billingAccountName, String enrollmentAccountName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getByEnrollmentAccountAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName), serviceCallback); + public ServiceFuture getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName), serviceCallback); } /** @@ -92,8 +251,8 @@ public ServiceFuture getByEnrollmentAccountAccountIdAsyn * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the EnrollmentAccountInner object */ - public Observable getByEnrollmentAccountAccountIdAsync(String billingAccountName, String enrollmentAccountName) { - return getByEnrollmentAccountAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName).map(new Func1, EnrollmentAccountInner>() { + public Observable getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName) { + return getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName).map(new Func1, EnrollmentAccountInner>() { @Override public EnrollmentAccountInner call(ServiceResponse response) { return response.body(); @@ -109,7 +268,7 @@ public EnrollmentAccountInner call(ServiceResponse respo * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the EnrollmentAccountInner object */ - public Observable> getByEnrollmentAccountAccountIdWithServiceResponseAsync(String billingAccountName, String enrollmentAccountName) { + public Observable> getByEnrollmentAccountIdWithServiceResponseAsync(String billingAccountName, String enrollmentAccountName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -121,12 +280,12 @@ public Observable> getByEnrollmentAccoun } final String expand = null; final String filter = null; - return service.getByEnrollmentAccountAccountId(billingAccountName, enrollmentAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + return service.getByEnrollmentAccountId(billingAccountName, enrollmentAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = getByEnrollmentAccountAccountIdDelegate(response); + ServiceResponse clientResponse = getByEnrollmentAccountIdDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -147,8 +306,8 @@ public Observable> call(Response getByEnrollmentAccountAccountIdAsync(String billingAccountName, String enrollmentAccountName, String expand, String filter, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getByEnrollmentAccountAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName, expand, filter), serviceCallback); + public ServiceFuture getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName, String expand, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName, expand, filter), serviceCallback); } /** @@ -176,8 +335,8 @@ public ServiceFuture getByEnrollmentAccountAccountIdAsyn * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the EnrollmentAccountInner object */ - public Observable getByEnrollmentAccountAccountIdAsync(String billingAccountName, String enrollmentAccountName, String expand, String filter) { - return getByEnrollmentAccountAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName, expand, filter).map(new Func1, EnrollmentAccountInner>() { + public Observable getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName, String expand, String filter) { + return getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName, expand, filter).map(new Func1, EnrollmentAccountInner>() { @Override public EnrollmentAccountInner call(ServiceResponse response) { return response.body(); @@ -195,7 +354,7 @@ public EnrollmentAccountInner call(ServiceResponse respo * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the EnrollmentAccountInner object */ - public Observable> getByEnrollmentAccountAccountIdWithServiceResponseAsync(String billingAccountName, String enrollmentAccountName, String expand, String filter) { + public Observable> getByEnrollmentAccountIdWithServiceResponseAsync(String billingAccountName, String enrollmentAccountName, String expand, String filter) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -205,12 +364,12 @@ public Observable> getByEnrollmentAccoun if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } - return service.getByEnrollmentAccountAccountId(billingAccountName, enrollmentAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + return service.getByEnrollmentAccountId(billingAccountName, enrollmentAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = getByEnrollmentAccountAccountIdDelegate(response); + ServiceResponse clientResponse = getByEnrollmentAccountIdDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -219,7 +378,7 @@ public Observable> call(Response getByEnrollmentAccountAccountIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + private ServiceResponse getByEnrollmentAccountIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .registerError(ErrorResponseException.class) diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionImpl.java index 301103ae54c8a..810439f62186f 100644 --- a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionImpl.java +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionImpl.java @@ -60,7 +60,7 @@ public Observable updateResourceAsync() { @Override protected Observable getInnerAsync() { InvoiceSectionsInner client = this.manager().inner().invoiceSections(); - return null; // NOP getInnerAsync implementation as get is not supported + return client.getAsync(this.billingAccountName, this.invoiceSectionName); } @Override 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 b63af7d0abfdb..ac31293fb3973 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 @@ -11,9 +11,9 @@ import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections; -import rx.Completable; -import rx.functions.Func1; import rx.Observable; +import rx.functions.Func1; +import rx.Completable; 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.InvoiceSectionProperties; @@ -35,9 +35,9 @@ private InvoiceSectionImpl wrapModel(InvoiceSectionInner inner) { } @Override - public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + public Observable listByBillingAccountNameAsync(String billingAccountName) { InvoiceSectionsInner client = this.inner(); - return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) + return client.listByBillingAccountNameAsync(billingAccountName) .map(new Func1() { @Override public InvoiceSectionListResult call(InvoiceSectionListResultInner inner) { @@ -47,13 +47,13 @@ public InvoiceSectionListResult call(InvoiceSectionListResultInner inner) { } @Override - public Observable getAsync(String billingAccountName, String invoiceSectionName) { + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { InvoiceSectionsInner client = this.inner(); - return client.getAsync(billingAccountName, invoiceSectionName) - .map(new Func1() { + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) + .map(new Func1() { @Override - public InvoiceSection call(InvoiceSectionInner inner) { - return new InvoiceSectionImpl(inner, manager()); + public InvoiceSectionListResult call(InvoiceSectionListResultInner inner) { + return new InvoiceSectionListResultImpl(inner, manager()); } }); } @@ -64,6 +64,18 @@ public Completable elevateToBillingProfileAsync(String billingAccountName, Strin return client.elevateToBillingProfileAsync(billingAccountName, invoiceSectionName).toCompletable(); } + @Override + public Observable getAsync(String billingAccountName, String invoiceSectionName) { + InvoiceSectionsInner client = this.inner(); + return client.getAsync(billingAccountName, invoiceSectionName) + .map(new Func1() { + @Override + public InvoiceSection call(InvoiceSectionInner inner) { + return wrapModel(inner); + } + }); + } + @Override public Observable createAsync(String billingAccountName, InvoiceSectionProperties parameters) { InvoiceSectionsInner client = this.inner(); @@ -76,4 +88,16 @@ public InvoiceSection call(InvoiceSectionInner inner) { }); } + @Override + public Observable listByCreateSubscriptionPermissionAsync(String billingAccountName) { + InvoiceSectionsInner client = this.inner(); + return client.listByCreateSubscriptionPermissionAsync(billingAccountName) + .map(new Func1() { + @Override + public InvoiceSectionListResult call(InvoiceSectionListResultInner inner) { + return new InvoiceSectionListResultImpl(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 d8ccd724c7a63..3e3b335a5ed24 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 @@ -59,6 +59,10 @@ public InvoiceSectionsInner(Retrofit retrofit, BillingManagementClientImpl clien * used by Retrofit to perform actually REST calls. */ interface InvoiceSectionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @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.InvoiceSections create" }) @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections") Observable> create(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body InvoiceSectionProperties parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -71,6 +75,10 @@ interface InvoiceSectionsService { @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections") 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.InvoiceSections listByCreateSubscriptionPermission" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission") + Observable> listByCreateSubscriptionPermission(@Path("billingAccountName") String billingAccountName, @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.InvoiceSections get" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}") Observable> get(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -89,6 +97,156 @@ interface InvoiceSectionsService { } + /** + * Lists all invoice sections for a user which he has access to. + * + * @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. + */ + public InvoiceSectionListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists all invoice sections for a user which he has access to. + * + * @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); + } + + /** + * Lists all invoice sections for a user which he has access to. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, InvoiceSectionListResultInner>() { + @Override + public InvoiceSectionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all invoice sections for a user which he has access to. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(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 expand = null; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all invoice sections for a user which he has access to. + * + * @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. + */ + public InvoiceSectionListResultInner listByBillingAccountName(String billingAccountName, String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand).toBlocking().single().body(); + } + + /** + * Lists all invoice sections for a user which he has access to. + * + * @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 listByBillingAccountNameAsync(String billingAccountName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand), serviceCallback); + } + + /** + * Lists all invoice sections for a user which he has access to. + * + * @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 + */ + public Observable listByBillingAccountNameAsync(String billingAccountName, String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand).map(new Func1, InvoiceSectionListResultInner>() { + @Override + public InvoiceSectionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all invoice sections for a user which he has access to. + * + * @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 + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand) { + 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(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * The operation to create a InvoiceSection. * @@ -324,6 +482,156 @@ private ServiceResponse listByBillingProfileNameD .build(response); } + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @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. + */ + public InvoiceSectionListResultInner listByCreateSubscriptionPermission(String billingAccountName) { + return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @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); + } + + /** + * 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 observable to the InvoiceSectionListResultInner object + */ + public Observable listByCreateSubscriptionPermissionAsync(String billingAccountName) { + return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName).map(new Func1, InvoiceSectionListResultInner>() { + @Override + public InvoiceSectionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 observable to the InvoiceSectionListResultInner object + */ + public Observable> listByCreateSubscriptionPermissionWithServiceResponseAsync(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 expand = null; + return service.listByCreateSubscriptionPermission(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByCreateSubscriptionPermissionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @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. + */ + public InvoiceSectionListResultInner listByCreateSubscriptionPermission(String billingAccountName, String expand) { + return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName, expand).toBlocking().single().body(); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @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); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @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 + */ + public Observable listByCreateSubscriptionPermissionAsync(String billingAccountName, String expand) { + return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName, expand).map(new Func1, InvoiceSectionListResultInner>() { + @Override + public InvoiceSectionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @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 + */ + public Observable> listByCreateSubscriptionPermissionWithServiceResponseAsync(String billingAccountName, String expand) { + 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.listByCreateSubscriptionPermission(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByCreateSubscriptionPermissionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByCreateSubscriptionPermissionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * Get the InvoiceSection by id. * 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 f4f33eb341c29..688680a42a21f 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 @@ -9,27 +9,18 @@ package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSummary; -import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; -import rx.Observable; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; 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; import org.joda.time.DateTime; import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentProperties; -class InvoiceSummaryImpl extends IndexableRefreshableWrapperImpl implements InvoiceSummary { +class InvoiceSummaryImpl extends WrapperImpl implements InvoiceSummary { private final BillingManager manager; - private String billingAccountName; - private String billingProfileName; - private String invoiceName; - - InvoiceSummaryImpl(InvoiceSummaryInner inner, BillingManager manager) { - super(null, inner); + InvoiceSummaryImpl(InvoiceSummaryInner inner, BillingManager manager) { + super(inner); this.manager = manager; - // set resource ancestor and positional variables - this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); - this.billingProfileName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingProfiles"); - this.invoiceName = IdParsingUtils.getValueFromIdByName(inner.id(), "invoices"); } @Override @@ -37,14 +28,6 @@ public BillingManager manager() { return this.manager; } - @Override - protected Observable getInnerAsync() { - InvoicesInner client = this.manager().inner().invoices(); - return client.getAsync(this.billingAccountName, this.billingProfileName, this.invoiceName); - } - - - @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 1f2da434bcdb3..ae569b98dd7db 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,15 +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.Observable; import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceListResult; import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSummary; class InvoicesImpl extends WrapperImpl implements Invoices { @@ -27,8 +28,28 @@ 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) { + InvoicesInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName, periodStartDate, periodEndDate) + .map(new Func1() { + @Override + public InvoiceListResult call(InvoiceListResultInner inner) { + return new InvoiceListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + InvoicesInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .map(new Func1() { + @Override + public InvoiceListResult call(InvoiceListResultInner inner) { + return new InvoiceListResultImpl(inner, manager()); + } + }); } @Override @@ -38,9 +59,9 @@ public Observable getAsync(String billingAccountName, String bil .map(new Func1() { @Override public InvoiceSummary call(InvoiceSummaryInner inner) { - return wrapModel(inner); + return new InvoiceSummaryImpl(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/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 89649c82f0191..fc7dfa059b761 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 @@ -51,6 +51,14 @@ public InvoicesInner(Retrofit retrofit, BillingManagementClientImpl client) { * used by Retrofit to perform actually REST calls. */ interface InvoicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Invoices listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @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 listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @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 get" }) @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); @@ -58,7 +66,194 @@ interface InvoicesService { } /** - * Get the invoice by id. + * List of invoices for a billing account. + * + * @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. + */ + public InvoiceListResultInner listByBillingAccountName(String billingAccountName, String periodStartDate, String periodEndDate) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate).toBlocking().single().body(); + } + + /** + * List of invoices for a billing account. + * + * @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); + } + + /** + * List of invoices for a billing account. + * + * @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 + */ + 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(); + } + }); + } + + /** + * List of invoices for a billing account. + * + * @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 + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String periodStartDate, String periodEndDate) { + 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."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(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); + } + + /** + * List of invoices for a billing profile. + * + * @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. + */ + public InvoiceListResultInner listByBillingProfile(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).toBlocking().single().body(); + } + + /** + * List of invoices for a billing profile. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile 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 listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate), serviceCallback); + } + + /** + * List of invoices for a billing profile. + * + * @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 + */ + 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(); + } + }); + } + + /** + * List of invoices for a billing profile. + * + * @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 + */ + public Observable> listByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName 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 (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the invoice by name. * * @param billingAccountName billing Account Id. * @param billingProfileName Billing Profile Id. @@ -73,7 +268,7 @@ public InvoiceSummaryInner get(String billingAccountName, String billingProfileN } /** - * Get the invoice by id. + * Get the invoice by name. * * @param billingAccountName billing Account Id. * @param billingProfileName Billing Profile Id. @@ -87,7 +282,7 @@ public ServiceFuture getAsync(String billingAccountName, St } /** - * Get the invoice by id. + * Get the invoice by name. * * @param billingAccountName billing Account Id. * @param billingProfileName Billing Profile Id. @@ -105,7 +300,7 @@ public InvoiceSummaryInner call(ServiceResponse response) { } /** - * Get the invoice by id. + * Get the invoice by name. * * @param billingAccountName billing Account Id. * @param billingProfileName Billing Profile Id. diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsImpl.java new file mode 100644 index 0000000000000..4954246a5bf16 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsImpl.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethods; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethod; + +class PaymentMethodsImpl extends WrapperImpl implements PaymentMethods { + private final BillingManager manager; + + PaymentMethodsImpl(BillingManager manager) { + super(manager.inner().paymentMethods()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private PaymentMethodImpl wrapModel(PaymentMethodInner inner) { + return new PaymentMethodImpl(inner, manager()); + } + + @Override + public Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName) { + PaymentMethodsInner client = this.inner(); + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PaymentMethod call(PaymentMethodInner 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/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 new file mode 100644 index 0000000000000..2faa106e3a93e --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsInner.java @@ -0,0 +1,300 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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 PaymentMethods. + */ +public class PaymentMethodsInner { + /** The Retrofit service to perform REST calls. */ + private PaymentMethodsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of PaymentMethodsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PaymentMethodsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(PaymentMethodsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PaymentMethods to be + * used by Retrofit to perform actually REST calls. + */ + interface PaymentMethodsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethods listByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethods") + 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.PaymentMethods listByBillingProfileNameNext" }) + @GET + Observable> listByBillingProfileNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the Payment Methods by billing profile 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 PagedList<PaymentMethodInner> object if successful. + */ + 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 the Payment Methods by billing profile 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(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 the Payment Methods by billing profile 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 + */ + 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 the Payment Methods by billing profile 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 + */ + 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 the Payment Methods by billing profile 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. + */ + public Observable>> listByBillingProfileNameSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName 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.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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 the Payment Methods by billing profile Id. + * + * @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<PaymentMethodInner> 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 Payment Methods by billing profile Id. + * + * @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 Payment Methods by billing profile Id. + * + * @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<PaymentMethodInner> 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 Payment Methods by billing profile Id. + * + * @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<PaymentMethodInner> 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 Payment Methods by billing profile Id. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PaymentMethodInner> 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); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesImpl.java new file mode 100644 index 0000000000000..097ff207a4369 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesImpl.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Policies; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Policy; + +class PoliciesImpl extends WrapperImpl implements Policies { + private final BillingManager manager; + + PoliciesImpl(BillingManager manager) { + super(manager.inner().policies()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + PoliciesInner client = this.inner(); + return client.getByBillingProfileNameAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public Policy call(PolicyInner inner) { + return new PolicyImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + PoliciesInner client = this.inner(); + return client.updateAsync(billingAccountName, billingProfileName, parameters) + .map(new Func1() { + @Override + public Policy call(PolicyInner inner) { + return new PolicyImpl(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/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 new file mode 100644 index 0000000000000..6fbe0b2f0bb37 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesInner.java @@ -0,0 +1,241 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Policies. + */ +public class PoliciesInner { + /** The Retrofit service to perform REST calls. */ + private PoliciesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of PoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PoliciesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(PoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Policies to be + * used by Retrofit to perform actually REST calls. + */ + interface PoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Policies getByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default") + Observable> getByBillingProfileName(@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.Policies update" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default") + Observable> update(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body PolicyInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * The policy for a given billing account name and billing profile name. + * + * @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 PolicyInner object if successful. + */ + public PolicyInner getByBillingProfileName(String billingAccountName, String billingProfileName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * The policy for a given billing account name and billing profile name. + * + * @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 getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * The policy for a given billing account name and billing profile name. + * + * @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 + */ + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, PolicyInner>() { + @Override + public PolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The policy for a given billing account name and billing profile name. + * + * @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 + */ + public Observable> getByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName 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.getByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to update a policy. + * + * @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 + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyInner object if successful. + */ + public PolicyInner update(String billingAccountName, String billingProfileName, PolicyInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().single().body(); + } + + /** + * The operation to update a policy. + * + * @param billingAccountName billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update policy 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 updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * The operation to update a policy. + * + * @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 + * @return the observable to the PolicyInner object + */ + public Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, PolicyInner>() { + @Override + public PolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update a policy. + * + * @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 + * @return the observable to the PolicyInner object + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(billingAccountName, billingProfileName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsImpl.java new file mode 100644 index 0000000000000..80050c23d22b5 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PriceSheets; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.DownloadUrl; + +class PriceSheetsImpl extends WrapperImpl implements PriceSheets { + private final BillingManager manager; + + PriceSheetsImpl(BillingManager manager) { + super(manager.inner().priceSheets()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable downloadAsync(String billingAccountName, String invoiceName) { + PriceSheetsInner client = this.inner(); + return client.downloadAsync(billingAccountName, invoiceName) + .map(new Func1() { + @Override + public DownloadUrl call(DownloadUrlInner inner) { + return new DownloadUrlImpl(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/PriceSheetsInner.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsInner.java new file mode 100644 index 0000000000000..d04958d1cfa95 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsInner.java @@ -0,0 +1,219 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PriceSheetDownloadHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; + +/** + * An instance of this class provides access to all the operations defined + * in PriceSheets. + */ +public class PriceSheetsInner { + /** The Retrofit service to perform REST calls. */ + private PriceSheetsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of PriceSheetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PriceSheetsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(PriceSheetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PriceSheets to be + * used by Retrofit to perform actually REST calls. + */ + interface PriceSheetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.PriceSheets download" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/pricesheet/default/download") + Observable> download(@Path("billingAccountName") String billingAccountName, @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.PriceSheets beginDownload" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/pricesheet/default/download") + Observable> beginDownload(@Path("billingAccountName") String billingAccountName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DownloadUrlInner object if successful. + */ + public DownloadUrlInner download(String billingAccountName, String invoiceName) { + return downloadWithServiceResponseAsync(billingAccountName, invoiceName).toBlocking().last().body(); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture downloadAsync(String billingAccountName, String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(downloadWithServiceResponseAsync(billingAccountName, invoiceName), serviceCallback); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable downloadAsync(String billingAccountName, String invoiceName) { + return downloadWithServiceResponseAsync(billingAccountName, invoiceName).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> downloadWithServiceResponseAsync(String billingAccountName, String invoiceName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.download(billingAccountName, invoiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType(), PriceSheetDownloadHeaders.class); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DownloadUrlInner object if successful. + */ + public DownloadUrlInner beginDownload(String billingAccountName, String invoiceName) { + return beginDownloadWithServiceResponseAsync(billingAccountName, invoiceName).toBlocking().single().body(); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDownloadAsync(String billingAccountName, String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginDownloadWithServiceResponseAsync(billingAccountName, invoiceName), serviceCallback); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable beginDownloadAsync(String billingAccountName, String invoiceName) { + return beginDownloadWithServiceResponseAsync(billingAccountName, invoiceName).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable> beginDownloadWithServiceResponseAsync(String billingAccountName, String invoiceName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName 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.beginDownload(billingAccountName, invoiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginDownloadDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginDownloadDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, PriceSheetDownloadHeaders.class); + } + +} diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductSummaryImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductSummaryImpl.java new file mode 100644 index 0000000000000..5760a724359cb --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductSummaryImpl.java @@ -0,0 +1,139 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.ProductSummary; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingFrequency; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ProductStatusType; + +class ProductSummaryImpl extends WrapperImpl implements ProductSummary { + private final BillingManager manager; + + ProductSummaryImpl(ProductSummaryInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public String availabilityId() { + return this.inner().availabilityId(); + } + + @Override + public BillingFrequency billingFrequency() { + return this.inner().billingFrequency(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String billingProfileName() { + return this.inner().billingProfileName(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public String invoiceSectionName() { + return this.inner().invoiceSectionName(); + } + + @Override + public Amount lastCharge() { + return this.inner().lastCharge(); + } + + @Override + public DateTime lastChargeDate() { + return this.inner().lastChargeDate(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String parentProductId() { + return this.inner().parentProductId(); + } + + @Override + public String productType() { + return this.inner().productType(); + } + + @Override + public String productTypeId() { + return this.inner().productTypeId(); + } + + @Override + public DateTime purchaseDate() { + return this.inner().purchaseDate(); + } + + @Override + public Double quantity() { + return this.inner().quantity(); + } + + @Override + public String skuDescription() { + return this.inner().skuDescription(); + } + + @Override + public String skuId() { + return this.inner().skuId(); + } + + @Override + public ProductStatusType status() { + return this.inner().status(); + } + + @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/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 61feebb8087d6..7399c28510274 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 @@ -13,8 +13,10 @@ import com.microsoft.azure.management.billing.v2018_11_01_preview.Products; import rx.Observable; import rx.functions.Func1; -import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccountProductSummary; -import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionBillingAccountProductSummary; +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.UpdateAutoRenewOperationSummary; class ProductsImpl extends WrapperImpl implements Products { private final BillingManager manager; @@ -28,32 +30,86 @@ public BillingManager manager() { return this.manager; } - private InvoiceSectionBillingAccountProductSummaryImpl wrapModel(ProductSummaryInner inner) { - return new InvoiceSectionBillingAccountProductSummaryImpl(inner, manager()); + private ProductSummaryImpl wrapModel(ProductSummaryInner inner) { + return new ProductSummaryImpl(inner, manager()); } @Override - public Observable transferAsync(String billingAccountName, String invoiceSectionName, String productName) { + public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { ProductsInner client = this.inner(); - return client.transferAsync(billingAccountName, invoiceSectionName, productName) - .map(new Func1() { + return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName) + .map(new Func1() { @Override - public BillingAccountProductSummary call(ProductSummaryInner inner) { - return new BillingAccountProductSummaryImpl(inner, manager()); + public ProductsListResult call(ProductsListResultInner inner) { + return new ProductsListResultImpl(inner, manager()); } }); } @Override - public Observable getAsync(String billingAccountName, String invoiceSectionName, String productName) { + public Observable getAsync(String billingAccountName, String invoiceSectionName, String productName) { ProductsInner client = this.inner(); return client.getAsync(billingAccountName, invoiceSectionName, productName) - .map(new Func1() { + .map(new Func1() { + @Override + public ProductSummary call(ProductSummaryInner inner) { + return new ProductSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable transferAsync(String billingAccountName, String invoiceSectionName, String productName) { + ProductsInner client = this.inner(); + return client.transferAsync(billingAccountName, invoiceSectionName, productName) + .map(new Func1() { @Override - public InvoiceSectionBillingAccountProductSummary call(ProductSummaryInner inner) { + public ProductSummary call(ProductSummaryInner inner) { + return new ProductSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName) { + ProductsInner client = this.inner(); + return client.updateAutoRenewByBillingAccountNameAsync(billingAccountName, productName) + .map(new Func1() { + @Override + public UpdateAutoRenewOperationSummary call(UpdateAutoRenewOperationSummaryInner inner) { + return new UpdateAutoRenewOperationSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName) { + ProductsInner client = this.inner(); + return client.updateAutoRenewByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, productName) + .map(new Func1() { + @Override + public UpdateAutoRenewOperationSummary call(UpdateAutoRenewOperationSummaryInner inner) { + return new UpdateAutoRenewOperationSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountNameAsync(final String billingAccountName) { + ProductsInner 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 ProductSummary call(ProductSummaryInner 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/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 6f67013ad6522..1168c09634a12 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 @@ -10,14 +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.ProductsTransferHeaders; import com.microsoft.azure.management.billing.v2018_11_01_preview.TransferProductRequestProperties; +import com.microsoft.azure.management.billing.v2018_11_01_preview.UpdateAutoRenew; +import com.microsoft.azure.management.billing.v2018_11_01_preview.UpdateAutoRenewRequest; +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 java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; @@ -26,6 +33,7 @@ import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -56,6 +64,14 @@ public ProductsInner(Retrofit retrofit, BillingManagementClientImpl client) { * used by Retrofit to perform actually REST calls. */ interface ProductsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Products listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @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.Products listByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products") + Observable> listByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @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.Products get" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}") Observable> get(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -64,6 +80,405 @@ interface ProductsService { @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/transfer") Observable> transfer(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TransferProductRequestProperties parameters, @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 updateAutoRenewByBillingAccountName" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/updateAutoRenew") + Observable> updateAutoRenewByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UpdateAutoRenewRequest body, @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 updateAutoRenewByInvoiceSectionName" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew") + Observable> updateAutoRenewByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UpdateAutoRenewRequest body, @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 listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists products by billing account name. + * + * @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<ProductSummaryInner> 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 products by billing account name. + * + * @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 products by billing account name. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists products by billing account name. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> 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 products by billing account name. + * + * @param billingAccountName billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductSummaryInner> 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; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), filter, 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 products by billing account name. + * + * @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 + * @throws ErrorResponseException 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 listByBillingAccountName(final String billingAccountName, final String filter) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists products by billing account name. + * + * @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 + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists products by billing account name. + * + * @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 + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists products by billing account name. + * + * @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 + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String filter) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, 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 products by billing account name. + * + 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. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String filter) { + 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, 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); + } + + /** + * Lists products by invoice section name. + * + * @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. + */ + public ProductsListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Lists products by invoice section name. + * + * @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); + } + + /** + * 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 ProductsListResultInner 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(); + } + }); + } + + /** + * 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 ProductsListResultInner object + */ + public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists products by invoice section name. + * + * @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 + * @throws ErrorResponseException 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. + */ + public ProductsListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String filter) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, filter).toBlocking().single().body(); + } + + /** + * Lists products by invoice section name. + * + * @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); + } + + /** + * Lists products by invoice section name. + * + * @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 + */ + 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(); + } + }); + } + + /** + * Lists products by invoice section name. + * + * @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 + */ + public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, 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."); + } + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByInvoiceSectionNameDelegate(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); } /** @@ -157,7 +572,7 @@ private ServiceResponse getDelegate(Response } /** - * The operation to transfer a Product to another InvoiceSection. + * The operation to transfer a Product to another invoice section. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -172,7 +587,7 @@ public ProductSummaryInner transfer(String billingAccountName, String invoiceSec } /** - * The operation to transfer a Product to another InvoiceSection. + * The operation to transfer a Product to another invoice section. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -186,7 +601,7 @@ public ServiceFuture transferAsync(String billingAccountNam } /** - * The operation to transfer a Product to another InvoiceSection. + * The operation to transfer a Product to another invoice section. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -204,7 +619,7 @@ public ProductSummaryInner call(ServiceResponseWithHeaders transferAsync(String billingAccountNam } /** - * The operation to transfer a Product to another InvoiceSection. + * The operation to transfer a Product to another invoice section. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -293,7 +708,7 @@ public ProductSummaryInner call(ServiceResponseWithHeaders .buildWithHeaders(response, ProductsTransferHeaders.class); } + /** + * Cancel auto renew for product by product id and billing account name. + * + * @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 + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UpdateAutoRenewOperationSummaryInner object if successful. + */ + public UpdateAutoRenewOperationSummaryInner updateAutoRenewByBillingAccountName(String billingAccountName, String productName) { + return updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName).toBlocking().single().body(); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @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 + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName), serviceCallback); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @param billingAccountName billing Account Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName) { + return updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { + @Override + public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @param billingAccountName billing Account Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable> updateAutoRenewByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String productName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName 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 UpdateAutoRenew autoRenew = null; + UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); + body.withAutoRenew(null); + return service.updateAutoRenewByBillingAccountName(billingAccountName, productName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateAutoRenewByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @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 + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UpdateAutoRenewOperationSummaryInner object if successful. + */ + public UpdateAutoRenewOperationSummaryInner updateAutoRenewByBillingAccountName(String billingAccountName, String productName, UpdateAutoRenew autoRenew) { + return updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName, autoRenew).toBlocking().single().body(); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName, UpdateAutoRenew autoRenew, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName, autoRenew), serviceCallback); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @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 + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName, UpdateAutoRenew autoRenew) { + return updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName, autoRenew).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { + @Override + public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @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 + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable> updateAutoRenewByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String productName, UpdateAutoRenew autoRenew) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); + body.withAutoRenew(autoRenew); + return service.updateAutoRenewByBillingAccountName(billingAccountName, productName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateAutoRenewByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateAutoRenewByBillingAccountNameDelegate(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); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice 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 UpdateAutoRenewOperationSummaryInner object if successful. + */ + public UpdateAutoRenewOperationSummaryInner updateAutoRenewByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String productName) { + return updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName).toBlocking().single().body(); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice 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 updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName), serviceCallback); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName) { + return updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { + @Override + public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable> updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String productName) { + 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 (productName == null) { + throw new IllegalArgumentException("Parameter productName 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 UpdateAutoRenew autoRenew = null; + UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); + body.withAutoRenew(null); + return service.updateAutoRenewByInvoiceSectionName(billingAccountName, invoiceSectionName, productName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateAutoRenewByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @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' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UpdateAutoRenewOperationSummaryInner object if successful. + */ + public UpdateAutoRenewOperationSummaryInner updateAutoRenewByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { + return updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, autoRenew).toBlocking().single().body(); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @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' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, autoRenew), serviceCallback); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @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' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { + return updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, autoRenew).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { + @Override + public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @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' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable> updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { + 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 (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); + body.withAutoRenew(autoRenew); + return service.updateAutoRenewByInvoiceSectionName(billingAccountName, invoiceSectionName, productName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateAutoRenewByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateAutoRenewByInvoiceSectionNameDelegate(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 products by billing account 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 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 products by billing account 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> 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 products by billing account 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> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists products by billing account 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>> 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 products by billing account 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>> 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/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 new file mode 100644 index 0000000000000..d42c5f69c15d8 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsImpl.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions; +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 { + private final BillingManager manager; + + TransactionsImpl(BillingManager manager) { + super(manager.inner().transactions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private TransactionsSummaryImpl wrapModel(TransactionsSummaryInner inner) { + return new TransactionsSummaryImpl(inner, manager()); + } + + @Override + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String startDate, String endDate) { + TransactionsInner client = this.inner(); + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName, startDate, endDate) + .map(new Func1() { + @Override + public TransactionsListResult call(TransactionsListResultInner inner) { + return new TransactionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String startDate, String endDate) { + TransactionsInner client = this.inner(); + return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, startDate, endDate) + .map(new Func1() { + @Override + public TransactionsListResult call(TransactionsListResultInner inner) { + return new TransactionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountNameAsync(final String billingAccountName, final String startDate, final String endDate) { + TransactionsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName, 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 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/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 new file mode 100644 index 0000000000000..626f39fef1548 --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsInner.java @@ -0,0 +1,828 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 Transactions. + */ +public class TransactionsInner { + /** The Retrofit service to perform REST calls. */ + private TransactionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of TransactionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransactionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(TransactionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Transactions to be + * used by Retrofit to perform actually REST calls. + */ + interface TransactionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/transactions") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @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 listByBillingProfileName" }) + @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 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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@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 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 listByBillingAccountName(final String billingAccountName, final String startDate, final String endDate) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, startDate, endDate).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 billingAccountName billing Account 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> listByBillingAccountNameAsync(final String billingAccountName, final String startDate, final String endDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, startDate, endDate), + 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 billingAccountName billing Account 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> listByBillingAccountNameAsync(final String billingAccountName, final String startDate, final String endDate) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, startDate, endDate) + .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 billingAccountName billing Account 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>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String startDate, final String endDate) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, 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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName billing Account 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>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String startDate, final String endDate) { + 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."); + } + 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.listByBillingAccountName(billingAccountName, 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 = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @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 (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 listByBillingAccountName(final String billingAccountName, final String startDate, final String endDate, final String filter) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, startDate, endDate, filter).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 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 (:). + * @param serviceCallback 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 startDate, final String endDate, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, startDate, endDate, filter), + 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 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 (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String startDate, final String endDate, final String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, startDate, endDate, filter) + .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 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 (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String startDate, final String endDate, final String filter) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, 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(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + 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 (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String startDate, final String endDate, final String filter) { + 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."); + } + 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.listByBillingAccountName(billingAccountName, 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 = 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); + } + + /** + * 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 + * @throws ErrorResponseException 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. + */ + public TransactionsListResultInner listByBillingProfileName(String billingAccountName, String billingProfileName, String startDate, String endDate) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate).toBlocking().single().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 + * @param serviceCallback 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, String startDate, String endDate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate), serviceCallback); + } + + /** + * 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 TransactionsListResultInner 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(); + } + }); + } + + /** + * 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 TransactionsListResultInner object + */ + public Observable> listByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName, String startDate, String endDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName 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.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 + * @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 TransactionsListResultInner object if successful. + */ + public TransactionsListResultInner listByBillingProfileName(String billingAccountName, String billingProfileName, String startDate, String endDate, String filter) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate, filter).toBlocking().single().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 + * @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 listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String startDate, String endDate, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate, filter), serviceCallback); + } + + /** + * 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 + * @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 + */ + 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(); + } + }); + } + + /** + * 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 + * @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 + */ + public Observable> listByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName, String startDate, String endDate, String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName 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.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 + * @throws ErrorResponseException 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. + */ + public TransactionsListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String startDate, String endDate) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate).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 serviceCallback 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); + } + + /** + * 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 to the TransactionsListResultInner 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(); + } + }); + } + + /** + * 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 to the TransactionsListResultInner object + */ + public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String startDate, 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 (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 clientResponse = listByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } 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 TransactionsListResultInner object if successful. + */ + public TransactionsListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String startDate, String endDate, String filter) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter).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(String billingAccountName, String invoiceSectionName, String startDate, String endDate, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter), 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 TransactionsListResultInner 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(); + } + }); + } + + /** + * 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 TransactionsListResultInner object + */ + public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String startDate, String endDate, 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 clientResponse = listByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the 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 + 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/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 53f390a71d477..f1eb343eae1ec 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 @@ -84,7 +84,7 @@ interface TransfersService { } /** - * Initiates the request to transfer the GTM or legacy subscriptions or RIs to GTM. + * Initiates the request to transfer the legacy subscriptions or RIs. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -99,7 +99,7 @@ public TransferDetailsInner initiate(String billingAccountName, String invoiceSe } /** - * Initiates the request to transfer the GTM or legacy subscriptions or RIs to GTM. + * Initiates the request to transfer the legacy subscriptions or RIs. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -113,7 +113,7 @@ public ServiceFuture initiateAsync(String billingAccountNa } /** - * Initiates the request to transfer the GTM or legacy subscriptions or RIs to GTM. + * Initiates the request to transfer the legacy subscriptions or RIs. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. @@ -131,7 +131,7 @@ public TransferDetailsInner call(ServiceResponse response) } /** - * Initiates the request to transfer the GTM or legacy subscriptions or RIs to GTM. + * Initiates the request to transfer the legacy subscriptions or RIs. * * @param billingAccountName billing Account Id. * @param invoiceSectionName InvoiceSection Id. diff --git a/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/UpdateAutoRenewOperationSummaryImpl.java b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/UpdateAutoRenewOperationSummaryImpl.java new file mode 100644 index 0000000000000..86b6d1dde6d7e --- /dev/null +++ b/billing/resource-manager/v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/UpdateAutoRenewOperationSummaryImpl.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.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.UpdateAutoRenewOperationSummary; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; + +class UpdateAutoRenewOperationSummaryImpl extends WrapperImpl implements UpdateAutoRenewOperationSummary { + private final BillingManager manager; + UpdateAutoRenewOperationSummaryImpl(UpdateAutoRenewOperationSummaryInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + +}