diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignment.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccountBillingRoleAssignment.java similarity index 67% rename from sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignment.java rename to sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccountBillingRoleAssignment.java index 7db03d45f45f3..d201203d94c20 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignment.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccountBillingRoleAssignment.java @@ -16,9 +16,9 @@ import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; /** - * Type representing BillingRoleAssignment. + * Type representing BillingAccountBillingRoleAssignment. */ -public interface BillingRoleAssignment extends HasInner, Indexable, Refreshable, HasManager { +public interface BillingAccountBillingRoleAssignment extends HasInner, Indexable, Refreshable, HasManager { /** * @return the billingRoleAssignmentName value. */ @@ -34,6 +34,11 @@ public interface BillingRoleAssignment extends HasInner listByBillingAccountAsync(String billingAccountName); + Observable listByBillingAccountAsync(final String billingAccountName); /** * Lists the billing permissions the caller has on an invoice section. @@ -54,4 +54,24 @@ public interface BillingPermissions { */ Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName); + /** + * Lists the billing permissions the caller has on a department. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDepartmentAsync(final String billingAccountName, final String departmentName); + + /** + * Lists the billing permissions the caller has on an enrollment account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName); + } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsListResult.java index 3a05157962c89..453980c0b1a5d 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsListResult.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsListResult.java @@ -12,6 +12,7 @@ import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingPermissionsListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingPermissionsPropertiesInner; import java.util.List; /** @@ -21,6 +22,6 @@ public interface BillingPermissionsListResult extends HasInner value(); + List value(); } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsProperties.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsProperties.java index b3af534f7fce4..b4c3f4fdc720f 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsProperties.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsProperties.java @@ -8,42 +8,24 @@ package com.microsoft.azure.management.billing.v2019_10_01_preview; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingPermissionsPropertiesInner; 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. + * Type representing BillingPermissionsProperties. */ -public class BillingPermissionsProperties { +public interface BillingPermissionsProperties extends HasInner, HasManager { /** - * The set of actions that the caller is allowed to perform. + * @return the actions value. */ - @JsonProperty(value = "actions", access = JsonProperty.Access.WRITE_ONLY) - private List actions; + List actions(); /** - * The set of actions that the caller is not allowed to perform. + * @return the notActions value. */ - @JsonProperty(value = "notActions", access = JsonProperty.Access.WRITE_ONLY) - private List notActions; - - /** - * Get the set of actions that the caller is allowed to perform. - * - * @return the actions value - */ - public List actions() { - return this.actions; - } - - /** - * Get the set of actions that the caller is not allowed to perform. - * - * @return the notActions value - */ - public List notActions() { - return this.notActions; - } + List notActions(); } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignments.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignments.java index 50c3d73f886fb..dc00fba9b4726 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignments.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignments.java @@ -27,7 +27,7 @@ public interface BillingRoleAssignments extends HasInner getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName); + Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName); /** * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. @@ -39,7 +39,7 @@ public interface BillingRoleAssignments extends HasInner deleteByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName); + Observable deleteByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName); /** * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. @@ -50,7 +50,7 @@ public interface BillingRoleAssignments extends HasInner getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName); /** * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. @@ -61,16 +61,51 @@ public interface BillingRoleAssignments extends HasInner deleteByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + Observable deleteByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName); /** - * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets a role assignment for the caller on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleAssignmentName); + + /** + * Deletes a role assignment for the caller on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleAssignmentName); + + /** + * Gets a role assignment for the caller on a enrollment Account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName); + + /** + * Deletes a role assignment for the caller on a enrollment Account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingAccountAsync(String billingAccountName); + Observable deleteByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName); /** * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. @@ -94,14 +129,43 @@ public interface BillingRoleAssignments extends HasInner listByBillingProfileAsync(String billingAccountName, String billingProfileName); /** - * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDepartmentAsync(final String billingAccountName, final String departmentName); + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName); + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName); + Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName); + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName); /** * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinitions.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinitions.java index 9321c3f5fc714..cd9ec3c3efb9d 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinitions.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinitions.java @@ -40,13 +40,26 @@ public interface BillingRoleDefinitions extends HasInner getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName); /** - * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets the definition for a role on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listByBillingAccountAsync(String billingAccountName); + Observable getByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleDefinitionName); + + /** + * Gets the definition for a role on an enrollment account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleDefinitionName); /** * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. @@ -69,6 +82,26 @@ public interface BillingRoleDefinitions extends HasInner listByBillingProfileAsync(String billingAccountName, String billingProfileName); + /** + * Lists the role definitions for a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDepartmentAsync(final String billingAccountName, final String departmentName); + + /** + * Lists the role definitions for a enrollmentAccount. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName); + /** * Gets the definition for a role on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. * @@ -79,4 +112,13 @@ public interface BillingRoleDefinitions extends HasInner getByBillingAccountAsync(String billingAccountName, String billingRoleDefinitionName); + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName); + } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountBillingAccountBillingRoleAssignment.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountBillingAccountBillingRoleAssignment.java new file mode 100644 index 0000000000000..8c52ea847142b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountBillingAccountBillingRoleAssignment.java @@ -0,0 +1,262 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.v2019_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingRoleAssignmentInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; + +/** + * Type representing EnrollmentAccountBillingAccountBillingRoleAssignment. + */ +public interface EnrollmentAccountBillingAccountBillingRoleAssignment extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the billingRoleAssignmentName value. + */ + String billingRoleAssignmentName(); + + /** + * @return the createdByPrincipalId value. + */ + String createdByPrincipalId(); + + /** + * @return the createdByPrincipalTenantId value. + */ + String createdByPrincipalTenantId(); + + /** + * @return the createdByUserEmailAddress value. + */ + String createdByUserEmailAddress(); + + /** + * @return the createdOn value. + */ + String createdOn(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the principalId value. + */ + String principalId(); + + /** + * @return the principalTenantId value. + */ + String principalTenantId(); + + /** + * @return the roleDefinitionId value. + */ + String roleDefinitionId(); + + /** + * @return the scope value. + */ + String scope(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the userAuthenticationType value. + */ + String userAuthenticationType(); + + /** + * @return the userEmailAddress value. + */ + String userEmailAddress(); + + /** + * The entirety of the EnrollmentAccountBillingAccountBillingRoleAssignment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithEnrollmentAccount, DefinitionStages.WithCreate { + } + + /** + * Grouping of EnrollmentAccountBillingAccountBillingRoleAssignment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a EnrollmentAccountBillingAccountBillingRoleAssignment definition. + */ + interface Blank extends WithEnrollmentAccount { + } + + /** + * The stage of the enrollmentaccountbillingaccountbillingroleassignment definition allowing to specify EnrollmentAccount. + */ + interface WithEnrollmentAccount { + /** + * Specifies billingAccountName, enrollmentAccountName. + * @param billingAccountName The ID that uniquely identifies a billing account + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account + * @return the next definition stage + */ + WithCreate withExistingEnrollmentAccount(String billingAccountName, String enrollmentAccountName); + } + + /** + * The stage of the enrollmentaccountbillingaccountbillingroleassignment definition allowing to specify PrincipalId. + */ + interface WithPrincipalId { + /** + * Specifies principalId. + * @param principalId The principal id of the user to whom the role was assigned + * @return the next definition stage + */ + WithCreate withPrincipalId(String principalId); + } + + /** + * The stage of the enrollmentaccountbillingaccountbillingroleassignment definition allowing to specify PrincipalTenantId. + */ + interface WithPrincipalTenantId { + /** + * Specifies principalTenantId. + * @param principalTenantId The principal tenant id of the user to whom the role was assigned + * @return the next definition stage + */ + WithCreate withPrincipalTenantId(String principalTenantId); + } + + /** + * The stage of the enrollmentaccountbillingaccountbillingroleassignment definition allowing to specify RoleDefinitionId. + */ + interface WithRoleDefinitionId { + /** + * Specifies roleDefinitionId. + * @param roleDefinitionId The ID of the role definition + * @return the next definition stage + */ + WithCreate withRoleDefinitionId(String roleDefinitionId); + } + + /** + * The stage of the enrollmentaccountbillingaccountbillingroleassignment definition allowing to specify UserAuthenticationType. + */ + interface WithUserAuthenticationType { + /** + * Specifies userAuthenticationType. + * @param userAuthenticationType The authentication type of the user, whether Organization or MSA, of the user to whom the role was assigned. This is supported only for billing accounts with agreement type Enterprise Agreement + * @return the next definition stage + */ + WithCreate withUserAuthenticationType(String userAuthenticationType); + } + + /** + * The stage of the enrollmentaccountbillingaccountbillingroleassignment definition allowing to specify UserEmailAddress. + */ + interface WithUserEmailAddress { + /** + * Specifies userEmailAddress. + * @param userEmailAddress The email address of the user to whom the role was assigned. This is supported only for billing accounts with agreement type Enterprise Agreement + * @return the next definition stage + */ + WithCreate withUserEmailAddress(String userEmailAddress); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithPrincipalId, DefinitionStages.WithPrincipalTenantId, DefinitionStages.WithRoleDefinitionId, DefinitionStages.WithUserAuthenticationType, DefinitionStages.WithUserEmailAddress { + } + } + /** + * The template for a EnrollmentAccountBillingAccountBillingRoleAssignment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithPrincipalId, UpdateStages.WithPrincipalTenantId, UpdateStages.WithRoleDefinitionId, UpdateStages.WithUserAuthenticationType, UpdateStages.WithUserEmailAddress { + } + + /** + * Grouping of EnrollmentAccountBillingAccountBillingRoleAssignment update stages. + */ + interface UpdateStages { + /** + * The stage of the enrollmentaccountbillingaccountbillingroleassignment update allowing to specify PrincipalId. + */ + interface WithPrincipalId { + /** + * Specifies principalId. + * @param principalId The principal id of the user to whom the role was assigned + * @return the next update stage + */ + Update withPrincipalId(String principalId); + } + + /** + * The stage of the enrollmentaccountbillingaccountbillingroleassignment update allowing to specify PrincipalTenantId. + */ + interface WithPrincipalTenantId { + /** + * Specifies principalTenantId. + * @param principalTenantId The principal tenant id of the user to whom the role was assigned + * @return the next update stage + */ + Update withPrincipalTenantId(String principalTenantId); + } + + /** + * The stage of the enrollmentaccountbillingaccountbillingroleassignment update allowing to specify RoleDefinitionId. + */ + interface WithRoleDefinitionId { + /** + * Specifies roleDefinitionId. + * @param roleDefinitionId The ID of the role definition + * @return the next update stage + */ + Update withRoleDefinitionId(String roleDefinitionId); + } + + /** + * The stage of the enrollmentaccountbillingaccountbillingroleassignment update allowing to specify UserAuthenticationType. + */ + interface WithUserAuthenticationType { + /** + * Specifies userAuthenticationType. + * @param userAuthenticationType The authentication type of the user, whether Organization or MSA, of the user to whom the role was assigned. This is supported only for billing accounts with agreement type Enterprise Agreement + * @return the next update stage + */ + Update withUserAuthenticationType(String userAuthenticationType); + } + + /** + * The stage of the enrollmentaccountbillingaccountbillingroleassignment update allowing to specify UserEmailAddress. + */ + interface WithUserEmailAddress { + /** + * Specifies userEmailAddress. + * @param userEmailAddress The email address of the user to whom the role was assigned. This is supported only for billing accounts with agreement type Enterprise Agreement + * @return the next update stage + */ + Update withUserEmailAddress(String userEmailAddress); + } + + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountRoleAssignments.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountRoleAssignments.java new file mode 100644 index 0000000000000..c8701c7afd306 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountRoleAssignments.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.EnrollmentAccountRoleAssignmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing EnrollmentAccountRoleAssignments. + */ +public interface EnrollmentAccountRoleAssignments extends SupportsCreating, HasInner { +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountBillingRoleAssignmentImpl.java similarity index 71% rename from sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentImpl.java rename to sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountBillingRoleAssignmentImpl.java index 7f7de87ef61a3..b0c1176348311 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentImpl.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountBillingRoleAssignmentImpl.java @@ -8,16 +8,16 @@ package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; -import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignment; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccountBillingRoleAssignment; import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; import rx.Observable; -class BillingRoleAssignmentImpl extends IndexableRefreshableWrapperImpl implements BillingRoleAssignment { +class BillingAccountBillingRoleAssignmentImpl extends IndexableRefreshableWrapperImpl implements BillingAccountBillingRoleAssignment { private final BillingManager manager; private String billingAccountName; private String billingRoleAssignmentName; - BillingRoleAssignmentImpl(BillingRoleAssignmentInner inner, BillingManager manager) { + BillingAccountBillingRoleAssignmentImpl(BillingRoleAssignmentInner inner, BillingManager manager) { super(null, inner); this.manager = manager; // set resource ancestor and positional variables @@ -53,6 +53,11 @@ public String createdByPrincipalTenantId() { return this.inner().createdByPrincipalTenantId(); } + @Override + public String createdByUserEmailAddress() { + return this.inner().createdByUserEmailAddress(); + } + @Override public String createdOn() { return this.inner().createdOn(); @@ -74,8 +79,13 @@ public String principalId() { } @Override - public String roleDefinitionName() { - return this.inner().roleDefinitionName(); + public String principalTenantId() { + return this.inner().principalTenantId(); + } + + @Override + public String roleDefinitionId() { + return this.inner().roleDefinitionId(); } @Override @@ -88,4 +98,14 @@ public String type() { return this.inner().type(); } + @Override + public String userAuthenticationType() { + return this.inner().userAuthenticationType(); + } + + @Override + public String userEmailAddress() { + return this.inner().userEmailAddress(); + } + } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManagementClientImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManagementClientImpl.java index 4649091ce8b6a..de32a79c5a30a 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManagementClientImpl.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManagementClientImpl.java @@ -446,6 +446,19 @@ public BillingRoleAssignmentsInner billingRoleAssignments() { return this.billingRoleAssignments; } + /** + * The EnrollmentAccountRoleAssignmentsInner object to access its operations. + */ + private EnrollmentAccountRoleAssignmentsInner enrollmentAccountRoleAssignments; + + /** + * Gets the EnrollmentAccountRoleAssignmentsInner object to access its operations. + * @return the EnrollmentAccountRoleAssignmentsInner object. + */ + public EnrollmentAccountRoleAssignmentsInner enrollmentAccountRoleAssignments() { + return this.enrollmentAccountRoleAssignments; + } + /** * The AgreementsInner object to access its operations. */ @@ -518,6 +531,7 @@ protected void initialize() { this.operations = new OperationsInner(restClient().retrofit(), this); this.billingRoleDefinitions = new BillingRoleDefinitionsInner(restClient().retrofit(), this); this.billingRoleAssignments = new BillingRoleAssignmentsInner(restClient().retrofit(), this); + this.enrollmentAccountRoleAssignments = new EnrollmentAccountRoleAssignmentsInner(restClient().retrofit(), this); this.agreements = new AgreementsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManager.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManager.java index de192c8915305..ee22dd7c36960 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManager.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManager.java @@ -40,6 +40,7 @@ import com.microsoft.azure.management.billing.v2019_10_01_preview.Operations; import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitions; import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments; +import com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccountRoleAssignments; import com.microsoft.azure.management.billing.v2019_10_01_preview.Agreements; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -72,6 +73,7 @@ public final class BillingManager extends ManagerCore implements BillingPermissions { private final BillingManager manager; @@ -40,13 +42,19 @@ public BillingPermissionsListResult call(BillingPermissionsListResultInner inner } @Override - public Observable listByBillingAccountAsync(String billingAccountName) { + public Observable listByBillingAccountAsync(final String billingAccountName) { BillingPermissionsInner client = this.inner(); return client.listByBillingAccountAsync(billingAccountName) - .map(new Func1() { + .flatMapIterable(new Func1, Iterable>() { @Override - public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { - return new BillingPermissionsListResultImpl(inner, manager()); + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingPermissionsProperties call(BillingPermissionsPropertiesInner inner) { + return new BillingPermissionsPropertiesImpl(inner, manager()); } }); } @@ -75,4 +83,40 @@ public BillingPermissionsListResult call(BillingPermissionsListResultInner inner }); } + @Override + public Observable listByDepartmentAsync(final String billingAccountName, final String departmentName) { + BillingPermissionsInner client = this.inner(); + return client.listByDepartmentAsync(billingAccountName, departmentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingPermissionsProperties call(BillingPermissionsPropertiesInner inner) { + return new BillingPermissionsPropertiesImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName) { + BillingPermissionsInner client = this.inner(); + return client.listByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingPermissionsProperties call(BillingPermissionsPropertiesInner inner) { + return new BillingPermissionsPropertiesImpl(inner, manager()); + } + }); + } + } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsInner.java index 20bb94e744ba3..93c10ec7cbdb6 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsInner.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsInner.java @@ -10,17 +10,23 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.billing.v2019_10_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; @@ -67,6 +73,26 @@ interface BillingPermissionsService { @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/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); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissions listByDepartment" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingPermissions") + Observable> listByDepartment(@Path("billingAccountName") String billingAccountName, @Path("departmentName") String departmentName, @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.v2019_10_01_preview.BillingPermissions listByEnrollmentAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingPermissions") + Observable> listByEnrollmentAccount(@Path("billingAccountName") String billingAccountName, @Path("enrollmentAccountName") String enrollmentAccountName, @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.v2019_10_01_preview.BillingPermissions listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissions listByDepartmentNext" }) + @GET + Observable> listByDepartmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissions listByEnrollmentAccountNext" }) + @GET + Observable> listByEnrollmentAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -159,10 +185,16 @@ private ServiceResponse listByCustomerDelegat * @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. + * @return the PagedList<BillingPermissionsPropertiesInner> object if successful. */ - public BillingPermissionsListResultInner listByBillingAccount(String billingAccountName) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + public PagedList listByBillingAccount(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -173,8 +205,16 @@ public BillingPermissionsListResultInner listByBillingAccount(String billingAcco * @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); + public ServiceFuture> listByBillingAccountAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -182,15 +222,16 @@ public ServiceFuture listByBillingAccountAsyn * * @param billingAccountName The ID that uniquely identifies a billing account. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingPermissionsListResultInner object + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object */ - public Observable listByBillingAccountAsync(String billingAccountName) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, BillingPermissionsListResultInner>() { - @Override - public BillingPermissionsListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingAccountAsync(final String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -198,9 +239,30 @@ public BillingPermissionsListResultInner call(ServiceResponse>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountSinglePageAsync(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(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName) { + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } @@ -208,12 +270,12 @@ public Observable> listByBill 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>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -221,9 +283,9 @@ public Observable> call(Respo }); } - private ServiceResponse listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(ErrorResponseException.class) .build(response); } @@ -401,4 +463,577 @@ private ServiceResponse listByBillingProfileD .build(response); } + /** + * Lists the billing permissions the caller has on a department. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @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<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByDepartment(final String billingAccountName, final String departmentName) { + ServiceResponse> response = listByDepartmentSinglePageAsync(billingAccountName, departmentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has on a department. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDepartmentAsync(final String billingAccountName, final String departmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentSinglePageAsync(billingAccountName, departmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has on a department. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByDepartmentAsync(final String billingAccountName, final String departmentName) { + return listByDepartmentWithServiceResponseAsync(billingAccountName, departmentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on a department. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByDepartmentWithServiceResponseAsync(final String billingAccountName, final String departmentName) { + return listByDepartmentSinglePageAsync(billingAccountName, departmentName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on a department. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentSinglePageAsync(final String billingAccountName, final String departmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (departmentName == null) { + throw new IllegalArgumentException("Parameter departmentName 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.listByDepartment(billingAccountName, departmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDepartmentDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on an enrollment account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @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<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByEnrollmentAccount(final String billingAccountName, final String enrollmentAccountName) { + ServiceResponse> response = listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has on an enrollment account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has on an enrollment account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName) { + return listByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on an enrollment account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByEnrollmentAccountWithServiceResponseAsync(final String billingAccountName, final String enrollmentAccountName) { + return listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on an enrollment account. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountSinglePageAsync(final String billingAccountName, final String enrollmentAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (enrollmentAccountName == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountName 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.listByEnrollmentAccount(billingAccountName, enrollmentAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEnrollmentAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on a department. + * + * @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<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByDepartmentNext(final String nextPageLink) { + ServiceResponse> response = listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has on a department. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDepartmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has on a department. + * + * @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<BillingPermissionsPropertiesInner> object + */ + public Observable> listByDepartmentNextAsync(final String nextPageLink) { + return listByDepartmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on a department. + * + * @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<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByDepartmentNextWithServiceResponseAsync(final String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on a department. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDepartmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDepartmentNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on an enrollment account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingPermissionsPropertiesInner> object if successful. + */ + public PagedList listByEnrollmentAccountNext(final String nextPageLink) { + ServiceResponse> response = listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billing permissions the caller has on an enrollment account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByEnrollmentAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billing permissions the caller has on an enrollment account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable> listByEnrollmentAccountNextAsync(final String nextPageLink) { + return listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on an enrollment account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingPermissionsPropertiesInner> object + */ + public Observable>> listByEnrollmentAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billing permissions the caller has on an enrollment account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingPermissionsPropertiesInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByEnrollmentAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEnrollmentAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultImpl.java index 3aa47d32be2ec..85d473fecea7d 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultImpl.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultImpl.java @@ -11,7 +11,6 @@ import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissionsListResult; import com.microsoft.azure.arm.model.implementation.WrapperImpl; import java.util.List; -import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissionsProperties; class BillingPermissionsListResultImpl extends WrapperImpl implements BillingPermissionsListResult { private final BillingManager manager; @@ -26,7 +25,7 @@ public BillingManager manager() { } @Override - public List value() { + public List value() { return this.inner().value(); } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultInner.java index 0bba27416ebd2..46854d0b776e8 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultInner.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultInner.java @@ -9,7 +9,6 @@ package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; import java.util.List; -import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissionsProperties; import com.fasterxml.jackson.annotation.JsonProperty; /** @@ -20,14 +19,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/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsPropertiesImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsPropertiesImpl.java new file mode 100644 index 0000000000000..27d3203d35e90 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsPropertiesImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissionsProperties; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class BillingPermissionsPropertiesImpl extends WrapperImpl implements BillingPermissionsProperties { + private final BillingManager manager; + BillingPermissionsPropertiesImpl(BillingPermissionsPropertiesInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public List actions() { + return this.inner().actions(); + } + + @Override + public List notActions() { + return this.inner().notActions(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsPropertiesInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsPropertiesInner.java new file mode 100644 index 0000000000000..4aa31c4ab5294 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsPropertiesInner.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.v2019_10_01_preview.implementation; + +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 BillingPermissionsPropertiesInner { + /** + * The set of actions that the caller is allowed to perform. + */ + @JsonProperty(value = "actions", access = JsonProperty.Access.WRITE_ONLY) + private List actions; + + /** + * The set of actions that the caller is not allowed to perform. + */ + @JsonProperty(value = "notActions", access = JsonProperty.Access.WRITE_ONLY) + private List notActions; + + /** + * Get the set of actions that the caller is allowed to perform. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Get the set of actions that the caller is not allowed to perform. + * + * @return the notActions value + */ + public List notActions() { + return this.notActions; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentInner.java index a3b1420ee8d57..d111049c856ee 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentInner.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentInner.java @@ -35,6 +35,14 @@ public class BillingRoleAssignmentInner extends ProxyResource { @JsonProperty(value = "properties.createdByPrincipalId", access = JsonProperty.Access.WRITE_ONLY) private String createdByPrincipalId; + /** + * The email address of the user who created the role assignment. This is + * supported only for billing accounts with agreement type Enterprise + * Agreement. + */ + @JsonProperty(value = "properties.createdByUserEmailAddress", access = JsonProperty.Access.WRITE_ONLY) + private String createdByUserEmailAddress; + /** * The name of the role assignment. */ @@ -44,14 +52,20 @@ public class BillingRoleAssignmentInner extends ProxyResource { /** * The principal id of the user to whom the role was assigned. */ - @JsonProperty(value = "properties.principalId", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "properties.principalId") private String principalId; + /** + * The principal tenant id of the user to whom the role was assigned. + */ + @JsonProperty(value = "properties.principalTenantId") + private String principalTenantId; + /** * The ID of the role definition. */ - @JsonProperty(value = "properties.roleDefinitionName", access = JsonProperty.Access.WRITE_ONLY) - private String roleDefinitionName; + @JsonProperty(value = "properties.roleDefinitionId") + private String roleDefinitionId; /** * The scope at which the role was assigned. @@ -59,6 +73,22 @@ public class BillingRoleAssignmentInner extends ProxyResource { @JsonProperty(value = "properties.scope", access = JsonProperty.Access.WRITE_ONLY) private String scope; + /** + * The email address of the user to whom the role was assigned. This is + * supported only for billing accounts with agreement type Enterprise + * Agreement. + */ + @JsonProperty(value = "properties.userEmailAddress") + private String userEmailAddress; + + /** + * The authentication type of the user, whether Organization or MSA, of the + * user to whom the role was assigned. This is supported only for billing + * accounts with agreement type Enterprise Agreement. + */ + @JsonProperty(value = "properties.userAuthenticationType") + private String userAuthenticationType; + /** * Get the date the role assignment was created. * @@ -86,6 +116,15 @@ public String createdByPrincipalId() { return this.createdByPrincipalId; } + /** + * Get the email address of the user who created the role assignment. This is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @return the createdByUserEmailAddress value + */ + public String createdByUserEmailAddress() { + return this.createdByUserEmailAddress; + } + /** * Get the name of the role assignment. * @@ -104,13 +143,55 @@ public String principalId() { return this.principalId; } + /** + * Set the principal id of the user to whom the role was assigned. + * + * @param principalId the principalId value to set + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the principal tenant id of the user to whom the role was assigned. + * + * @return the principalTenantId value + */ + public String principalTenantId() { + return this.principalTenantId; + } + + /** + * Set the principal tenant id of the user to whom the role was assigned. + * + * @param principalTenantId the principalTenantId value to set + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withPrincipalTenantId(String principalTenantId) { + this.principalTenantId = principalTenantId; + return this; + } + /** * Get the ID of the role definition. * - * @return the roleDefinitionName value + * @return the roleDefinitionId value + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the ID of the role definition. + * + * @param roleDefinitionId the roleDefinitionId value to set + * @return the BillingRoleAssignmentInner object itself. */ - public String roleDefinitionName() { - return this.roleDefinitionName; + public BillingRoleAssignmentInner withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; } /** @@ -122,4 +203,44 @@ public String scope() { return this.scope; } + /** + * Get the email address of the user to whom the role was assigned. This is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @return the userEmailAddress value + */ + public String userEmailAddress() { + return this.userEmailAddress; + } + + /** + * Set the email address of the user to whom the role was assigned. This is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param userEmailAddress the userEmailAddress value to set + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withUserEmailAddress(String userEmailAddress) { + this.userEmailAddress = userEmailAddress; + return this; + } + + /** + * Get the authentication type of the user, whether Organization or MSA, of the user to whom the role was assigned. This is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @return the userAuthenticationType value + */ + public String userAuthenticationType() { + return this.userAuthenticationType; + } + + /** + * Set the authentication type of the user, whether Organization or MSA, of the user to whom the role was assigned. This is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param userAuthenticationType the userAuthenticationType value to set + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withUserAuthenticationType(String userAuthenticationType) { + this.userAuthenticationType = userAuthenticationType; + return this; + } + } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsImpl.java index 91fddda04a0d3..96e0ec404a8bf 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsImpl.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsImpl.java @@ -14,7 +14,8 @@ import rx.Completable; import rx.Observable; import rx.functions.Func1; -import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignment; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccountBillingRoleAssignment; import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignmentListResult; import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignmentPayload; @@ -30,66 +31,102 @@ public BillingManager manager() { return this.manager; } - private BillingRoleAssignmentImpl wrapModel(BillingRoleAssignmentInner inner) { - return new BillingRoleAssignmentImpl(inner, manager()); + private BillingAccountBillingRoleAssignmentImpl wrapModel(BillingRoleAssignmentInner inner) { + return new BillingAccountBillingRoleAssignmentImpl(inner, manager()); } @Override - public Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + public Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { BillingRoleAssignmentsInner client = this.inner(); return client.getByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName) - .map(new Func1() { + .map(new Func1() { @Override - public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { - return new BillingRoleAssignmentImpl(inner, manager()); + public BillingAccountBillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingAccountBillingRoleAssignmentImpl(inner, manager()); } }); } @Override - public Observable deleteByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + public Observable deleteByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { BillingRoleAssignmentsInner client = this.inner(); return client.deleteByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName) - .map(new Func1() { + .map(new Func1() { @Override - public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { - return new BillingRoleAssignmentImpl(inner, manager()); + public BillingAccountBillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingAccountBillingRoleAssignmentImpl(inner, manager()); } }); } @Override - public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { BillingRoleAssignmentsInner client = this.inner(); return client.getByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName) - .map(new Func1() { + .map(new Func1() { @Override - public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { - return new BillingRoleAssignmentImpl(inner, manager()); + public BillingAccountBillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingAccountBillingRoleAssignmentImpl(inner, manager()); } }); } @Override - public Observable deleteByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + public Observable deleteByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { BillingRoleAssignmentsInner client = this.inner(); return client.deleteByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName) - .map(new Func1() { + .map(new Func1() { @Override - public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { - return new BillingRoleAssignmentImpl(inner, manager()); + public BillingAccountBillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingAccountBillingRoleAssignmentImpl(inner, manager()); } }); } @Override - public Observable listByBillingAccountAsync(String billingAccountName) { + public Observable getByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleAssignmentName) { BillingRoleAssignmentsInner client = this.inner(); - return client.listByBillingAccountAsync(billingAccountName) - .map(new Func1() { + return client.getByDepartmentAsync(billingAccountName, departmentName, billingRoleAssignmentName) + .map(new Func1() { @Override - public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { - return new BillingRoleAssignmentListResultImpl(inner, manager()); + public BillingAccountBillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingAccountBillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByDepartmentAsync(billingAccountName, departmentName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingAccountBillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingAccountBillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingAccountBillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingAccountBillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingAccountBillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingAccountBillingRoleAssignmentImpl(inner, manager()); } }); } @@ -119,16 +156,70 @@ public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner } @Override - public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + public Observable listByDepartmentAsync(final String billingAccountName, final String departmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByDepartmentAsync(billingAccountName, departmentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingAccountBillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingAccountBillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingAccountBillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingAccountBillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingAccountBillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { BillingRoleAssignmentsInner client = this.inner(); return client.getByBillingAccountAsync(billingAccountName, billingRoleAssignmentName) - .flatMap(new Func1>() { + .flatMap(new Func1>() { @Override - public Observable call(BillingRoleAssignmentInner inner) { + public Observable call(BillingRoleAssignmentInner inner) { if (inner == null) { return Observable.empty(); } else { - return Observable.just((BillingRoleAssignment)wrapModel(inner)); + return Observable.just((BillingAccountBillingRoleAssignment)wrapModel(inner)); } } }); diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsInner.java index f44fcc7c9786f..891ec1e7c7e82 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsInner.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsInner.java @@ -10,13 +10,18 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignmentPayload; import com.microsoft.azure.management.billing.v2019_10_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; import java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; @@ -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; @@ -80,6 +86,22 @@ interface BillingRoleAssignmentsService { @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) Observable> deleteByBillingProfile(@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.v2019_10_01_preview.BillingRoleAssignments getByDepartment" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByDepartment(@Path("billingAccountName") String billingAccountName, @Path("departmentName") String departmentName, @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.v2019_10_01_preview.BillingRoleAssignments deleteByDepartment" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByDepartment(@Path("billingAccountName") String billingAccountName, @Path("departmentName") String departmentName, @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.v2019_10_01_preview.BillingRoleAssignments getByEnrollmentAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByEnrollmentAccount(@Path("billingAccountName") String billingAccountName, @Path("enrollmentAccountName") String enrollmentAccountName, @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.v2019_10_01_preview.BillingRoleAssignments deleteByEnrollmentAccount" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByEnrollmentAccount(@Path("billingAccountName") String billingAccountName, @Path("enrollmentAccountName") String enrollmentAccountName, @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.v2019_10_01_preview.BillingRoleAssignments listByBillingAccount" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments") Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -104,10 +126,30 @@ interface BillingRoleAssignmentsService { @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/createBillingRoleAssignment") Observable> addByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body BillingRoleAssignmentPayload parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments listByDepartment" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments") + Observable> listByDepartment(@Path("billingAccountName") String billingAccountName, @Path("departmentName") String departmentName, @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.v2019_10_01_preview.BillingRoleAssignments listByEnrollmentAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments") + Observable> listByEnrollmentAccount(@Path("billingAccountName") String billingAccountName, @Path("enrollmentAccountName") String enrollmentAccountName, @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.v2019_10_01_preview.BillingRoleAssignments listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments listByDepartmentNext" }) + @GET + Observable> listByDepartmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments listByEnrollmentAccountNext" }) + @GET + Observable> listByEnrollmentAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** - * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. @@ -121,7 +163,7 @@ public BillingRoleAssignmentInner getByBillingAccount(String billingAccountName, } /** - * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. @@ -134,7 +176,7 @@ public ServiceFuture getByBillingAccountAsync(String } /** - * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. @@ -151,7 +193,7 @@ public BillingRoleAssignmentInner call(ServiceResponse deleteByBillingProfileDelega } /** - * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets a role assignment for the caller on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @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. + * @return the BillingRoleAssignmentInner object if successful. */ - public BillingRoleAssignmentListResultInner listByBillingAccount(String billingAccountName) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + public BillingRoleAssignmentInner getByDepartment(String billingAccountName, String departmentName, String billingRoleAssignmentName) { + return getByDepartmentWithServiceResponseAsync(billingAccountName, departmentName, billingRoleAssignmentName).toBlocking().single().body(); } /** - * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets a role assignment for the caller on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @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); + public ServiceFuture getByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByDepartmentWithServiceResponseAsync(billingAccountName, departmentName, billingRoleAssignmentName), serviceCallback); } /** - * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets a role assignment for the caller on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleAssignmentListResultInner object + * @return the observable to the BillingRoleAssignmentInner object */ - public Observable listByBillingAccountAsync(String billingAccountName) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, BillingRoleAssignmentListResultInner>() { + public Observable getByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleAssignmentName) { + return getByDepartmentWithServiceResponseAsync(billingAccountName, departmentName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { @Override - public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + public BillingRoleAssignmentInner call(ServiceResponse response) { return response.body(); } }); } /** - * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets a role assignment for the caller on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleAssignmentListResultInner object + * @return the observable to the BillingRoleAssignmentInner object */ - public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName) { + public Observable> getByDepartmentWithServiceResponseAsync(String billingAccountName, String departmentName, String billingRoleAssignmentName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } + if (departmentName == null) { + throw new IllegalArgumentException("Parameter departmentName 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.listByBillingAccount(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.getByDepartment(billingAccountName, departmentName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountDelegate(response); + ServiceResponse clientResponse = getByDepartmentDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -715,82 +771,88 @@ public Observable> call(Re }); } - private ServiceResponse listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse getByDepartmentDelegate(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); } /** - * Adds a role assignment on a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Deletes a role assignment for the caller on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param parameters Request parameters that are provided to the create billing role assignment operation. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @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. + * @return the BillingRoleAssignmentInner object if successful. */ - public BillingRoleAssignmentListResultInner addByBillingAccount(String billingAccountName, BillingRoleAssignmentPayload parameters) { - return addByBillingAccountWithServiceResponseAsync(billingAccountName, parameters).toBlocking().single().body(); + public BillingRoleAssignmentInner deleteByDepartment(String billingAccountName, String departmentName, String billingRoleAssignmentName) { + return deleteByDepartmentWithServiceResponseAsync(billingAccountName, departmentName, billingRoleAssignmentName).toBlocking().single().body(); } /** - * Adds a role assignment on a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Deletes a role assignment for the caller on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param parameters Request parameters that are provided to the create billing role assignment operation. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @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 addByBillingAccountAsync(String billingAccountName, BillingRoleAssignmentPayload parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(addByBillingAccountWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + public ServiceFuture deleteByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByDepartmentWithServiceResponseAsync(billingAccountName, departmentName, billingRoleAssignmentName), serviceCallback); } /** - * Adds a role assignment on a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Deletes a role assignment for the caller on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param parameters Request parameters that are provided to the create billing role assignment operation. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleAssignmentListResultInner object + * @return the observable to the BillingRoleAssignmentInner object */ - public Observable addByBillingAccountAsync(String billingAccountName, BillingRoleAssignmentPayload parameters) { - return addByBillingAccountWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingRoleAssignmentListResultInner>() { + public Observable deleteByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleAssignmentName) { + return deleteByDepartmentWithServiceResponseAsync(billingAccountName, departmentName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { @Override - public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + public BillingRoleAssignmentInner call(ServiceResponse response) { return response.body(); } }); } /** - * Adds a role assignment on a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Deletes a role assignment for the caller on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param parameters Request parameters that are provided to the create billing role assignment operation. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleAssignmentListResultInner object + * @return the observable to the BillingRoleAssignmentInner object */ - public Observable> addByBillingAccountWithServiceResponseAsync(String billingAccountName, BillingRoleAssignmentPayload parameters) { + public Observable> deleteByDepartmentWithServiceResponseAsync(String billingAccountName, String departmentName, String billingRoleAssignmentName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } + if (departmentName == null) { + throw new IllegalArgumentException("Parameter departmentName 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."); } - if (parameters == null) { - throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); - } - Validator.validate(parameters); - return service.addByBillingAccount(billingAccountName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.deleteByDepartment(billingAccountName, departmentName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = addByBillingAccountDelegate(response); + ServiceResponse clientResponse = deleteByDepartmentDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -799,88 +861,88 @@ public Observable> call(Re }); } - private ServiceResponse addByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(201, new TypeToken() { }.getType()) + private ServiceResponse deleteByDepartmentDelegate(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 assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Gets a role assignment for the caller on a enrollment Account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @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. + * @return the BillingRoleAssignmentInner object if successful. */ - public BillingRoleAssignmentListResultInner listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName) { - return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single().body(); + public BillingRoleAssignmentInner getByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName) { + return getByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleAssignmentName).toBlocking().single().body(); } /** - * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Gets a role assignment for the caller on a enrollment Account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @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 listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName), serviceCallback); + public ServiceFuture getByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleAssignmentName), serviceCallback); } /** - * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Gets a role assignment for the caller on a enrollment Account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleAssignmentListResultInner object + * @return the observable to the BillingRoleAssignmentInner object */ - public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { - return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, BillingRoleAssignmentListResultInner>() { + public Observable getByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName) { + return getByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { @Override - public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + public BillingRoleAssignmentInner call(ServiceResponse response) { return response.body(); } }); } /** - * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Gets a role assignment for the caller on a enrollment Account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleAssignmentListResultInner object + * @return the observable to the BillingRoleAssignmentInner object */ - public Observable> listByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + public Observable> getByEnrollmentAccountWithServiceResponseAsync(String billingAccountName, String enrollmentAccountName, 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 (enrollmentAccountName == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountName 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.listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.getByEnrollmentAccount(billingAccountName, enrollmentAccountName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = listByInvoiceSectionDelegate(response); + ServiceResponse clientResponse = getByEnrollmentAccountDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -889,96 +951,88 @@ public Observable> call(Re }); } - private ServiceResponse listByInvoiceSectionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse getByEnrollmentAccountDelegate(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); } /** - * Adds a role assignment on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Deletes a role assignment for the caller on a enrollment Account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. - * @param parameters Request parameters that are provided to the create billing role assignment operation. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @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. + * @return the BillingRoleAssignmentInner object if successful. */ - public BillingRoleAssignmentListResultInner addByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentPayload parameters) { - return addByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).toBlocking().single().body(); + public BillingRoleAssignmentInner deleteByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName) { + return deleteByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleAssignmentName).toBlocking().single().body(); } /** - * Adds a role assignment on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Deletes a role assignment for the caller on a enrollment Account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. - * @param parameters Request parameters that are provided to the create billing role assignment operation. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @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 addByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentPayload parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(addByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters), serviceCallback); + public ServiceFuture deleteByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleAssignmentName), serviceCallback); } /** - * Adds a role assignment on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Deletes a role assignment for the caller on a enrollment Account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. - * @param parameters Request parameters that are provided to the create billing role assignment operation. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleAssignmentListResultInner object + * @return the observable to the BillingRoleAssignmentInner object */ - public Observable addByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentPayload parameters) { - return addByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).map(new Func1, BillingRoleAssignmentListResultInner>() { + public Observable deleteByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName) { + return deleteByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { @Override - public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + public BillingRoleAssignmentInner call(ServiceResponse response) { return response.body(); } }); } /** - * Adds a role assignment on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Deletes a role assignment for the caller on a enrollment Account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. - * @param parameters Request parameters that are provided to the create billing role assignment operation. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleAssignmentListResultInner object + * @return the observable to the BillingRoleAssignmentInner object */ - public Observable> addByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentPayload parameters) { + public Observable> deleteByEnrollmentAccountWithServiceResponseAsync(String billingAccountName, String enrollmentAccountName, 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 (enrollmentAccountName == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountName 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."); } - if (parameters == null) { - throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); - } - Validator.validate(parameters); - return service.addByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.deleteByEnrollmentAccount(billingAccountName, enrollmentAccountName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = addByInvoiceSectionDelegate(response); + ServiceResponse clientResponse = deleteByEnrollmentAccountDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -987,82 +1041,111 @@ public Observable> call(Re }); } - private ServiceResponse addByInvoiceSectionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(201, new TypeToken() { }.getType()) + private ServiceResponse deleteByEnrollmentAccountDelegate(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 assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. * @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. + * @return the PagedList<BillingRoleAssignmentInner> object if successful. */ - public BillingRoleAssignmentListResultInner listByBillingProfile(String billingAccountName, String billingProfileName) { - return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + public PagedList listByBillingAccount(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** - * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. * @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); + public ServiceFuture> listByBillingAccountAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** - * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleAssignmentListResultInner object + * @return the observable to the PagedList<BillingRoleAssignmentInner> object */ - public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { - return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingRoleAssignmentListResultInner>() { - @Override - public BillingRoleAssignmentListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listByBillingAccountAsync(final String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** - * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleAssignmentListResultInner object + * @return the observable to the PagedList<BillingRoleAssignmentInner> object */ - public Observable> listByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountSinglePageAsync(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(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName) { 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>>() { + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listByBillingProfileDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1070,54 +1153,51 @@ public Observable> call(Re }); } - private ServiceResponse listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(ErrorResponseException.class) .build(response); } /** - * Adds a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Adds a role assignment on a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters Request parameters that are provided to the create billing role assignment 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 BillingRoleAssignmentListResultInner object if successful. */ - public BillingRoleAssignmentListResultInner addByBillingProfile(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters) { - return addByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().single().body(); + public BillingRoleAssignmentListResultInner addByBillingAccount(String billingAccountName, BillingRoleAssignmentPayload parameters) { + return addByBillingAccountWithServiceResponseAsync(billingAccountName, parameters).toBlocking().single().body(); } /** - * Adds a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Adds a role assignment on a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters Request parameters that are provided to the create billing role assignment 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 addByBillingProfileAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(addByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + public ServiceFuture addByBillingAccountAsync(String billingAccountName, BillingRoleAssignmentPayload parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addByBillingAccountWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); } /** - * Adds a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * Adds a role assignment on a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters Request parameters that are provided to the create billing role assignment operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleAssignmentListResultInner object */ - public Observable addByBillingProfileAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters) { - return addByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, BillingRoleAssignmentListResultInner>() { - @Override + public Observable addByBillingAccountAsync(String billingAccountName, BillingRoleAssignmentPayload parameters) { + return addByBillingAccountWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override public BillingRoleAssignmentListResultInner call(ServiceResponse response) { return response.body(); } @@ -1125,21 +1205,205 @@ public BillingRoleAssignmentListResultInner call(ServiceResponse> addByBillingAccountWithServiceResponseAsync(String billingAccountName, BillingRoleAssignmentPayload parameters) { + 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.addByBillingAccount(billingAccountName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addByBillingAccountDelegate(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); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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 listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @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 listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName), serviceCallback); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> listByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + 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 (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.listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByInvoiceSectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByInvoiceSectionDelegate(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); + } + + /** + * Adds a role assignment on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters Request parameters that are provided to the create billing role assignment 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 BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner addByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentPayload parameters) { + return addByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).toBlocking().single().body(); + } + + /** + * Adds a role assignment on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters Request parameters that are provided to the create billing role assignment 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 addByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentPayload parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters), serviceCallback); + } + + /** + * Adds a role assignment on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. * @param parameters Request parameters that are provided to the create billing role assignment operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the BillingRoleAssignmentListResultInner object */ - public Observable> addByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters) { + public Observable addByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentPayload parameters) { + return addByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Adds a role assignment on an invoice section. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters Request parameters that are provided to the create billing role assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> addByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentPayload 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 (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."); } @@ -1147,12 +1411,12 @@ public Observable> addByBi throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); - return service.addByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + return service.addByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = addByBillingProfileDelegate(response); + ServiceResponse clientResponse = addByInvoiceSectionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -1161,11 +1425,758 @@ public Observable> call(Re }); } - private ServiceResponse addByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + private ServiceResponse addByInvoiceSectionDelegate(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); } + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 listByBillingProfile(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner 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); + } + + /** + * Adds a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the create billing role assignment 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 BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner addByBillingProfile(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters) { + return addByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().single().body(); + } + + /** + * Adds a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the create billing role assignment 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 addByBillingProfileAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * Adds a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the create billing role assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable addByBillingProfileAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters) { + return addByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Adds a role assignment on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the create billing role assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> addByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload 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.addByBillingProfile(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 = addByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addByBillingProfileDelegate(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); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @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<BillingRoleAssignmentInner> object if successful. + */ + public PagedList listByDepartment(final String billingAccountName, final String departmentName) { + ServiceResponse> response = listByDepartmentSinglePageAsync(billingAccountName, departmentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDepartmentAsync(final String billingAccountName, final String departmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentSinglePageAsync(billingAccountName, departmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable> listByDepartmentAsync(final String billingAccountName, final String departmentName) { + return listByDepartmentWithServiceResponseAsync(billingAccountName, departmentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable>> listByDepartmentWithServiceResponseAsync(final String billingAccountName, final String departmentName) { + return listByDepartmentSinglePageAsync(billingAccountName, departmentName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentSinglePageAsync(final String billingAccountName, final String departmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (departmentName == null) { + throw new IllegalArgumentException("Parameter departmentName 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.listByDepartment(billingAccountName, departmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDepartmentDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @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<BillingRoleAssignmentInner> object if successful. + */ + public PagedList listByEnrollmentAccount(final String billingAccountName, final String enrollmentAccountName) { + ServiceResponse> response = listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable> listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName) { + return listByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleAssignmentInner> object + */ + public Observable>> listByEnrollmentAccountWithServiceResponseAsync(final String billingAccountName, final String enrollmentAccountName) { + return listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountSinglePageAsync(final String billingAccountName, final String enrollmentAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (enrollmentAccountName == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountName 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.listByEnrollmentAccount(billingAccountName, enrollmentAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEnrollmentAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @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<BillingRoleAssignmentInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @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<BillingRoleAssignmentInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @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<BillingRoleAssignmentInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @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<BillingRoleAssignmentInner> object if successful. + */ + public PagedList listByDepartmentNext(final String nextPageLink) { + ServiceResponse> response = listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDepartmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @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<BillingRoleAssignmentInner> object + */ + public Observable> listByDepartmentNextAsync(final String nextPageLink) { + return listByDepartmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @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<BillingRoleAssignmentInner> object + */ + public Observable>> listByDepartmentNextWithServiceResponseAsync(final String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDepartmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDepartmentNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @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<BillingRoleAssignmentInner> object if successful. + */ + public PagedList listByEnrollmentAccountNext(final String nextPageLink) { + ServiceResponse> response = listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByEnrollmentAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @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<BillingRoleAssignmentInner> object + */ + public Observable> listByEnrollmentAccountNextAsync(final String nextPageLink) { + return listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + * @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<BillingRoleAssignmentInner> object + */ + public Observable>> listByEnrollmentAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts of type Enterprise Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByEnrollmentAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEnrollmentAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionImpl.java index 78aac771a0e10..442698beff400 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionImpl.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionImpl.java @@ -11,8 +11,9 @@ import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinition; import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; import rx.Observable; -import java.util.List; +import java.util.ArrayList; import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissionsProperties; +import java.util.List; class BillingRoleDefinitionImpl extends IndexableRefreshableWrapperImpl implements BillingRoleDefinition { private final BillingManager manager; @@ -57,7 +58,13 @@ public String name() { @Override public List permissions() { - return this.inner().permissions(); + List lst = new ArrayList(); + if (this.inner().permissions() != null) { + for (BillingPermissionsPropertiesInner inner : this.inner().permissions()) { + lst.add( new BillingPermissionsPropertiesImpl(inner, manager())); + } + } + return lst; } @Override diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionInner.java index f705030001214..b00f822fa1486 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionInner.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionInner.java @@ -9,7 +9,6 @@ package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; import java.util.List; -import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissionsProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; import com.microsoft.azure.ProxyResource; @@ -29,7 +28,7 @@ public class BillingRoleDefinitionInner extends ProxyResource { * The billingPermissions the role has. */ @JsonProperty(value = "properties.permissions") - private List permissions; + private List permissions; /** * The name of the role. @@ -51,7 +50,7 @@ public String description() { * * @return the permissions value */ - public List permissions() { + public List permissions() { return this.permissions; } @@ -61,7 +60,7 @@ public List permissions() { * @param permissions the permissions value to set * @return the BillingRoleDefinitionInner object itself. */ - public BillingRoleDefinitionInner withPermissions(List permissions) { + public BillingRoleDefinitionInner withPermissions(List permissions) { this.permissions = permissions; return this; } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsImpl.java index b7552b30c02f6..cda683834cf89 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsImpl.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsImpl.java @@ -13,6 +13,7 @@ import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitions; import rx.Observable; import rx.functions.Func1; +import com.microsoft.azure.Page; import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinition; import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitionListResult; @@ -57,13 +58,25 @@ public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { } @Override - public Observable listByBillingAccountAsync(String billingAccountName) { + public Observable getByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleDefinitionName) { BillingRoleDefinitionsInner client = this.inner(); - return client.listByBillingAccountAsync(billingAccountName) - .map(new Func1() { + return client.getByDepartmentAsync(billingAccountName, departmentName, billingRoleDefinitionName) + .map(new Func1() { @Override - public BillingRoleDefinitionListResult call(BillingRoleDefinitionListResultInner inner) { - return new BillingRoleDefinitionListResultImpl(inner, manager()); + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, billingRoleDefinitionName) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); } }); } @@ -92,6 +105,60 @@ public BillingRoleDefinitionListResult call(BillingRoleDefinitionListResultInner }); } + @Override + public Observable listByDepartmentAsync(final String billingAccountName, final String departmentName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByDepartmentAsync(billingAccountName, departmentName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return wrapModel(inner); + } + }); + } + @Override public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleDefinitionName) { BillingRoleDefinitionsInner client = this.inner(); diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsInner.java index 5a6d399156c4e..2b94a752f89f1 100644 --- a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsInner.java +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsInner.java @@ -10,17 +10,23 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.billing.v2019_10_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.Path; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -63,6 +69,14 @@ interface BillingRoleDefinitionsService { @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{billingRoleDefinitionName}") Observable> getByBillingProfile(@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.v2019_10_01_preview.BillingRoleDefinitions getByDepartment" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByDepartment(@Path("billingAccountName") String billingAccountName, @Path("departmentName") String departmentName, @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.v2019_10_01_preview.BillingRoleDefinitions getByEnrollmentAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByEnrollmentAccount(@Path("billingAccountName") String billingAccountName, @Path("enrollmentAccountName") String enrollmentAccountName, @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.v2019_10_01_preview.BillingRoleDefinitions listByBillingAccount" }) @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions") Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -75,6 +89,26 @@ interface BillingRoleDefinitionsService { @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions") 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); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitions listByDepartment" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleDefinitions") + Observable> listByDepartment(@Path("billingAccountName") String billingAccountName, @Path("departmentName") String departmentName, @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.v2019_10_01_preview.BillingRoleDefinitions listByEnrollmentAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleDefinitions") + Observable> listByEnrollmentAccount(@Path("billingAccountName") String billingAccountName, @Path("enrollmentAccountName") String enrollmentAccountName, @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.v2019_10_01_preview.BillingRoleDefinitions listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitions listByDepartmentNext" }) + @GET + Observable> listByDepartmentNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitions listByEnrollmentAccountNext" }) + @GET + Observable> listByEnrollmentAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -348,66 +382,80 @@ private ServiceResponse getByBillingProfileDelegate( } /** - * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets the definition for a role on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. * @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. + * @return the BillingRoleDefinitionInner object if successful. */ - public BillingRoleDefinitionListResultInner listByBillingAccount(String billingAccountName) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + public BillingRoleDefinitionInner getByDepartment(String billingAccountName, String departmentName, String billingRoleDefinitionName) { + return getByDepartmentWithServiceResponseAsync(billingAccountName, departmentName, billingRoleDefinitionName).toBlocking().single().body(); } /** - * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets the definition for a role on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. * @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); + public ServiceFuture getByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByDepartmentWithServiceResponseAsync(billingAccountName, departmentName, billingRoleDefinitionName), serviceCallback); } /** - * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets the definition for a role on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleDefinitionListResultInner object + * @return the observable to the BillingRoleDefinitionInner object */ - public Observable listByBillingAccountAsync(String billingAccountName) { - return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, BillingRoleDefinitionListResultInner>() { + public Observable getByDepartmentAsync(String billingAccountName, String departmentName, String billingRoleDefinitionName) { + return getByDepartmentWithServiceResponseAsync(billingAccountName, departmentName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { @Override - public BillingRoleDefinitionListResultInner call(ServiceResponse response) { + public BillingRoleDefinitionInner call(ServiceResponse response) { return response.body(); } }); } /** - * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * Gets the definition for a role on a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the BillingRoleDefinitionListResultInner object + * @return the observable to the BillingRoleDefinitionInner object */ - public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName) { + public Observable> getByDepartmentWithServiceResponseAsync(String billingAccountName, String departmentName, String billingRoleDefinitionName) { if (billingAccountName == null) { throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); } + if (departmentName == null) { + throw new IllegalArgumentException("Parameter departmentName 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.listByBillingAccount(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.getByDepartment(billingAccountName, departmentName, billingRoleDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = listByBillingAccountDelegate(response); + ServiceResponse clientResponse = getByDepartmentDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -416,9 +464,211 @@ public Observable> call(Re }); } - private ServiceResponse listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse getByDepartmentDelegate(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 definition for a role on an enrollment account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @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 getByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, String billingRoleDefinitionName) { + return getByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the definition for a role on an enrollment account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @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 getByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the definition for a role on an enrollment account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable getByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, String billingRoleDefinitionName) { + return getByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the definition for a role on an enrollment account. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable> getByEnrollmentAccountWithServiceResponseAsync(String billingAccountName, String enrollmentAccountName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (enrollmentAccountName == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountName 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.getByEnrollmentAccount(billingAccountName, enrollmentAccountName, billingRoleDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByEnrollmentAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByEnrollmentAccountDelegate(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 definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountSinglePageAsync(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(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(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.listByBillingAccount(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(ErrorResponseException.class) .build(response); } @@ -596,4 +846,577 @@ private ServiceResponse listByBillingProfi .build(response); } + /** + * Lists the role definitions for a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @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<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByDepartment(final String billingAccountName, final String departmentName) { + ServiceResponse> response = listByDepartmentSinglePageAsync(billingAccountName, departmentName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDepartmentAsync(final String billingAccountName, final String departmentName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentSinglePageAsync(billingAccountName, departmentName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable> listByDepartmentAsync(final String billingAccountName, final String departmentName) { + return listByDepartmentWithServiceResponseAsync(billingAccountName, departmentName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable>> listByDepartmentWithServiceResponseAsync(final String billingAccountName, final String departmentName) { + return listByDepartmentSinglePageAsync(billingAccountName, departmentName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param departmentName The ID that uniquely identifies a department. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentSinglePageAsync(final String billingAccountName, final String departmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (departmentName == null) { + throw new IllegalArgumentException("Parameter departmentName 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.listByDepartment(billingAccountName, departmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDepartmentDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definitions for a enrollmentAccount. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @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<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByEnrollmentAccount(final String billingAccountName, final String enrollmentAccountName) { + ServiceResponse> response = listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for a enrollmentAccount. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for a enrollmentAccount. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable> listByEnrollmentAccountAsync(final String billingAccountName, final String enrollmentAccountName) { + return listByEnrollmentAccountWithServiceResponseAsync(billingAccountName, enrollmentAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for a enrollmentAccount. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingRoleDefinitionInner> object + */ + public Observable>> listByEnrollmentAccountWithServiceResponseAsync(final String billingAccountName, final String enrollmentAccountName) { + return listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for a enrollmentAccount. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountSinglePageAsync(final String billingAccountName, final String enrollmentAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (enrollmentAccountName == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountName 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.listByEnrollmentAccount(billingAccountName, enrollmentAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEnrollmentAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @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<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByBillingAccountNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @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<BillingRoleDefinitionInner> object + */ + public Observable> listByBillingAccountNextAsync(final String nextPageLink) { + return listByBillingAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @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<BillingRoleDefinitionInner> object + */ + public Observable>> listByBillingAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definitions for a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @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<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByDepartmentNext(final String nextPageLink) { + ServiceResponse> response = listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByDepartmentNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByDepartmentNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @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<BillingRoleDefinitionInner> object + */ + public Observable> listByDepartmentNextAsync(final String nextPageLink) { + return listByDepartmentNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @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<BillingRoleDefinitionInner> object + */ + public Observable>> listByDepartmentNextWithServiceResponseAsync(final String nextPageLink) { + return listByDepartmentNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByDepartmentNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for a department. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByDepartmentNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByDepartmentNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDepartmentNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByDepartmentNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definitions for a enrollmentAccount. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @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<BillingRoleDefinitionInner> object if successful. + */ + public PagedList listByEnrollmentAccountNext(final String nextPageLink) { + ServiceResponse> response = listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the role definitions for a enrollmentAccount. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByEnrollmentAccountNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByEnrollmentAccountNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the role definitions for a enrollmentAccount. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @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<BillingRoleDefinitionInner> object + */ + public Observable> listByEnrollmentAccountNextAsync(final String nextPageLink) { + return listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for a enrollmentAccount. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @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<BillingRoleDefinitionInner> object + */ + public Observable>> listByEnrollmentAccountNextWithServiceResponseAsync(final String nextPageLink) { + return listByEnrollmentAccountNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByEnrollmentAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the role definitions for a enrollmentAccount. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingRoleDefinitionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByEnrollmentAccountNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByEnrollmentAccountNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByEnrollmentAccountNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByEnrollmentAccountNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + } diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountBillingAccountBillingRoleAssignmentImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountBillingAccountBillingRoleAssignmentImpl.java new file mode 100644 index 0000000000000..b381e4efee9c4 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountBillingAccountBillingRoleAssignmentImpl.java @@ -0,0 +1,179 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccountBillingAccountBillingRoleAssignment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class EnrollmentAccountBillingAccountBillingRoleAssignmentImpl extends CreatableUpdatableImpl implements EnrollmentAccountBillingAccountBillingRoleAssignment, EnrollmentAccountBillingAccountBillingRoleAssignment.Definition, EnrollmentAccountBillingAccountBillingRoleAssignment.Update { + private final BillingManager manager; + private String billingAccountName; + private String enrollmentAccountName; + private String billingRoleAssignmentName; + + EnrollmentAccountBillingAccountBillingRoleAssignmentImpl(String name, BillingManager manager) { + super(name, new BillingRoleAssignmentInner()); + this.manager = manager; + // Set resource name + this.billingRoleAssignmentName = name; + // + } + + EnrollmentAccountBillingAccountBillingRoleAssignmentImpl(BillingRoleAssignmentInner inner, BillingManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.billingRoleAssignmentName = inner.name(); + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.enrollmentAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "enrollmentAccounts"); + this.billingRoleAssignmentName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingRoleAssignments"); + // + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + EnrollmentAccountRoleAssignmentsInner client = this.manager().inner().enrollmentAccountRoleAssignments(); + return client.putAsync(this.billingAccountName, this.enrollmentAccountName, this.billingRoleAssignmentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + EnrollmentAccountRoleAssignmentsInner client = this.manager().inner().enrollmentAccountRoleAssignments(); + return client.putAsync(this.billingAccountName, this.enrollmentAccountName, this.billingRoleAssignmentName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + EnrollmentAccountRoleAssignmentsInner client = this.manager().inner().enrollmentAccountRoleAssignments(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String billingRoleAssignmentName() { + return this.inner().billingRoleAssignmentName(); + } + + @Override + public String createdByPrincipalId() { + return this.inner().createdByPrincipalId(); + } + + @Override + public String createdByPrincipalTenantId() { + return this.inner().createdByPrincipalTenantId(); + } + + @Override + public String createdByUserEmailAddress() { + return this.inner().createdByUserEmailAddress(); + } + + @Override + public String createdOn() { + return this.inner().createdOn(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String principalId() { + return this.inner().principalId(); + } + + @Override + public String principalTenantId() { + return this.inner().principalTenantId(); + } + + @Override + public String roleDefinitionId() { + return this.inner().roleDefinitionId(); + } + + @Override + public String scope() { + return this.inner().scope(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String userAuthenticationType() { + return this.inner().userAuthenticationType(); + } + + @Override + public String userEmailAddress() { + return this.inner().userEmailAddress(); + } + + @Override + public EnrollmentAccountBillingAccountBillingRoleAssignmentImpl withExistingEnrollmentAccount(String billingAccountName, String enrollmentAccountName) { + this.billingAccountName = billingAccountName; + this.enrollmentAccountName = enrollmentAccountName; + return this; + } + + @Override + public EnrollmentAccountBillingAccountBillingRoleAssignmentImpl withPrincipalId(String principalId) { + this.inner().withPrincipalId(principalId); + return this; + } + + @Override + public EnrollmentAccountBillingAccountBillingRoleAssignmentImpl withPrincipalTenantId(String principalTenantId) { + this.inner().withPrincipalTenantId(principalTenantId); + return this; + } + + @Override + public EnrollmentAccountBillingAccountBillingRoleAssignmentImpl withRoleDefinitionId(String roleDefinitionId) { + this.inner().withRoleDefinitionId(roleDefinitionId); + return this; + } + + @Override + public EnrollmentAccountBillingAccountBillingRoleAssignmentImpl withUserAuthenticationType(String userAuthenticationType) { + this.inner().withUserAuthenticationType(userAuthenticationType); + return this; + } + + @Override + public EnrollmentAccountBillingAccountBillingRoleAssignmentImpl withUserEmailAddress(String userEmailAddress) { + this.inner().withUserEmailAddress(userEmailAddress); + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountRoleAssignmentsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountRoleAssignmentsImpl.java new file mode 100644 index 0000000000000..532701d48bf76 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountRoleAssignmentsImpl.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccountRoleAssignments; + +class EnrollmentAccountRoleAssignmentsImpl extends WrapperImpl implements EnrollmentAccountRoleAssignments { + private final BillingManager manager; + + EnrollmentAccountRoleAssignmentsImpl(BillingManager manager) { + super(manager.inner().enrollmentAccountRoleAssignments()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public EnrollmentAccountBillingAccountBillingRoleAssignmentImpl define(String name) { + return wrapModel(name); + } + + private EnrollmentAccountBillingAccountBillingRoleAssignmentImpl wrapModel(BillingRoleAssignmentInner inner) { + return new EnrollmentAccountBillingAccountBillingRoleAssignmentImpl(inner, manager()); + } + + private EnrollmentAccountBillingAccountBillingRoleAssignmentImpl wrapModel(String name) { + return new EnrollmentAccountBillingAccountBillingRoleAssignmentImpl(name, this.manager()); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountRoleAssignmentsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountRoleAssignmentsInner.java new file mode 100644 index 0000000000000..a433d500fc743 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountRoleAssignmentsInner.java @@ -0,0 +1,160 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2019_10_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.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 EnrollmentAccountRoleAssignments. + */ +public class EnrollmentAccountRoleAssignmentsInner { + /** The Retrofit service to perform REST calls. */ + private EnrollmentAccountRoleAssignmentsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of EnrollmentAccountRoleAssignmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EnrollmentAccountRoleAssignmentsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(EnrollmentAccountRoleAssignmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for EnrollmentAccountRoleAssignments to be + * used by Retrofit to perform actually REST calls. + */ + interface EnrollmentAccountRoleAssignmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccountRoleAssignments put" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> put(@Path("billingAccountName") String billingAccountName, @Path("enrollmentAccountName") String enrollmentAccountName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @Body BillingRoleAssignmentInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create or update a billing role assignment. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param parameters The new or updated billing role assignment. + * @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 put(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { + return putWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleAssignmentName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a billing role assignment. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param parameters The new or updated billing role assignment. + * @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 putAsync(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(putWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleAssignmentName, parameters), serviceCallback); + } + + /** + * Create or update a billing role assignment. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param parameters The new or updated billing role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable putAsync(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { + return putWithServiceResponseAsync(billingAccountName, enrollmentAccountName, billingRoleAssignmentName, parameters).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a billing role assignment. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The ID that uniquely identifies an enrollment account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param parameters The new or updated billing role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> putWithServiceResponseAsync(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (enrollmentAccountName == null) { + throw new IllegalArgumentException("Parameter enrollmentAccountName 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."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.put(billingAccountName, enrollmentAccountName, billingRoleAssignmentName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = putDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse putDelegate(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); + } + +}