From 0cea33ea471050bcb2ca466fa5a1782f812216dc Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Fri, 12 Jun 2020 22:12:16 +0000 Subject: [PATCH] Update from master --- sdk/billing/mgmt-v2019_10_01_preview/pom.xml | 135 ++ .../AcceptTransferRequest.java | 46 + .../v2019_10_01_preview/AcceptanceMode.java | 44 + .../v2019_10_01_preview/AccountType.java | 44 + .../billing/v2019_10_01_preview/Address.java | 28 + .../v2019_10_01_preview/AddressDetails.java | 277 +++ .../AddressValidationStatus.java | 41 + .../v2019_10_01_preview/Agreement.java | 74 + .../AgreementListResult.java | 32 + .../v2019_10_01_preview/AgreementType.java | 47 + .../v2019_10_01_preview/Agreements.java | 38 + .../billing/v2019_10_01_preview/Amount.java | 58 + .../v2019_10_01_preview/AvailableBalance.java | 40 + .../AvailableBalances.java | 29 + .../v2019_10_01_preview/AzurePlan.java | 58 + .../v2019_10_01_preview/BillingAccount.java | 152 ++ .../BillingAccountListResult.java | 32 + .../BillingAccountUpdateRequest.java | 223 +++ .../v2019_10_01_preview/BillingAccounts.java | 45 + .../v2019_10_01_preview/BillingFrequency.java | 44 + .../BillingPermissions.java | 57 + .../BillingPermissionsListResult.java | 26 + .../BillingPermissionsProperties.java | 49 + .../v2019_10_01_preview/BillingProfile.java | 276 +++ .../BillingProfileCreationRequest.java | 150 ++ .../BillingProfileListResult.java | 32 + .../BillingProfileSpendingLimit.java | 41 + .../BillingProfileStatus.java | 44 + .../BillingProfileStatusReasonCode.java | 44 + .../v2019_10_01_preview/BillingProfiles.java | 39 + .../BillingProfilesCreateHeaders.java | 70 + .../BillingProfilesUpdateHeaders.java | 70 + .../v2019_10_01_preview/BillingProperty.java | 110 ++ .../v2019_10_01_preview/BillingPropertys.java | 27 + .../BillingRoleAssignment.java | 72 + .../BillingRoleAssignmentListResult.java | 27 + .../BillingRoleAssignmentPayload.java | 69 + .../BillingRoleAssignments.java | 149 ++ .../BillingRoleDefinition.java | 53 + .../BillingRoleDefinitionListResult.java | 27 + .../BillingRoleDefinitions.java | 82 + .../BillingSubscription.java | 108 ++ .../BillingSubscriptionStatusType.java | 50 + .../BillingSubscriptions.java | 108 ++ .../BillingSubscriptionsListResult.java | 32 + .../BillingSubscriptionsTransferHeaders.java | 70 + .../billing/v2019_10_01_preview/Category.java | 44 + .../billing/v2019_10_01_preview/Customer.java | 51 + ...gProfileBillingAccountTransferDetails.java | 92 + .../v2019_10_01_preview/CustomerPolicy.java | 40 + .../v2019_10_01_preview/CustomerType.java | 44 + .../v2019_10_01_preview/Customers.java | 48 + .../v2019_10_01_preview/Department.java | 58 + .../DepartmentListResult.java | 32 + .../v2019_10_01_preview/Departments.java | 38 + .../DetailedTransferStatus.java | 90 + .../billing/v2019_10_01_preview/Document.java | 64 + .../v2019_10_01_preview/DocumentType.java | 47 + .../v2019_10_01_preview/DownloadUrl.java | 31 + .../EligibleProductType.java | 44 + .../v2019_10_01_preview/Enrollment.java | 175 ++ .../EnrollmentAccount.java | 73 + .../EnrollmentAccountContext.java | 122 ++ .../EnrollmentAccountListResult.java | 32 + .../EnrollmentAccounts.java | 38 + .../EnrollmentPolicies.java | 80 + .../billing/v2019_10_01_preview/Error.java | 47 + .../v2019_10_01_preview/ErrorDetails.java | 62 + .../v2019_10_01_preview/ErrorResponse.java | 44 + .../ErrorResponseException.java | 44 + .../InitiateTransferRequest.java | 72 + .../v2019_10_01_preview/Instruction.java | 169 ++ .../v2019_10_01_preview/Instructions.java | 41 + .../billing/v2019_10_01_preview/Invoice.java | 159 ++ .../InvoiceListResult.java | 32 + .../v2019_10_01_preview/InvoiceSection.java | 117 ++ ...gProfileBillingAccountTransferDetails.java | 92 + .../InvoiceSectionCreationRequest.java | 43 + .../InvoiceSectionListResult.java | 32 + ...InvoiceSectionWithCreateSubPermission.java | 61 + .../v2019_10_01_preview/InvoiceSections.java | 53 + .../InvoiceSectionsCreateHeaders.java | 70 + .../InvoiceSectionsUpdateHeaders.java | 70 + .../v2019_10_01_preview/InvoiceStatus.java | 47 + .../v2019_10_01_preview/InvoiceType.java | 44 + .../billing/v2019_10_01_preview/Invoices.java | 86 + .../MarketplacePurchasesPolicy.java | 44 + .../v2019_10_01_preview/Operation.java | 30 + .../v2019_10_01_preview/OperationDisplay.java | 63 + .../v2019_10_01_preview/Operations.java | 27 + .../v2019_10_01_preview/Participants.java | 63 + .../v2019_10_01_preview/PartnerTransfers.java | 67 + .../v2019_10_01_preview/PaymentMethod.java | 55 + .../PaymentMethodFamily.java | 47 + .../PaymentMethodType.java | 41 + .../v2019_10_01_preview/PaymentMethods.java | 38 + .../PaymentProperties.java | 105 ++ .../billing/v2019_10_01_preview/Policies.java | 61 + .../billing/v2019_10_01_preview/Policy.java | 50 + ...eSheetDownloadByBillingProfileHeaders.java | 96 + .../PriceSheetDownloadHeaders.java | 96 + .../v2019_10_01_preview/PriceSheets.java | 38 + .../billing/v2019_10_01_preview/Product.java | 148 ++ .../v2019_10_01_preview/ProductDetails.java | 70 + .../ProductStatusType.java | 59 + .../ProductTransferStatus.java | 47 + .../ProductTransferValidationErrorCode.java | 62 + .../v2019_10_01_preview/ProductType.java | 41 + .../billing/v2019_10_01_preview/Products.java | 110 ++ .../ProductsListResult.java | 32 + .../ProductsTransferHeaders.java | 70 + .../RebillDocumentType.java | 44 + .../RecipientTransferDetails.java | 82 + .../RecipientTransfers.java | 63 + .../billing/v2019_10_01_preview/Reseller.java | 47 + .../ReservationPurchasesPolicy.java | 41 + .../v2019_10_01_preview/ReservationType.java | 41 + .../v2019_10_01_preview/SpendingLimit.java | 41 + .../v2019_10_01_preview/StatusReasonCode.java | 44 + ...bscriptionTransferValidationErrorCode.java | 59 + .../v2019_10_01_preview/Transaction.java | 206 +++ .../TransactionListResult.java | 32 + .../TransactionTypeKind.java | 41 + .../v2019_10_01_preview/Transactions.java | 91 + .../TransferBillingSubscriptionRequest.java | 71 + ...rBillingSubscriptionRequestProperties.java | 69 + .../TransferBillingSubscriptionResult.java | 25 + .../TransferProductRequestProperties.java | 69 + .../v2019_10_01_preview/TransferStatus.java | 56 + .../v2019_10_01_preview/Transfers.java | 67 + .../v2019_10_01_preview/UpdateAutoRenew.java | 41 + .../UpdateAutoRenewOperation.java | 26 + .../UpdateAutoRenewRequest.java | 44 + .../ValidateAddressResponse.java | 36 + ...lidateProductTransferEligibilityError.java | 100 ++ ...idateProductTransferEligibilityResult.java | 30 + ...eSubscriptionTransferEligibilityError.java | 99 + ...SubscriptionTransferEligibilityResult.java | 30 + .../ValidateTransferListResponse.java | 26 + .../ValidateTransferResponse.java | 76 + .../ValidationResultProperties.java | 62 + .../v2019_10_01_preview/ViewCharges.java | 41 + .../ViewChargesPolicy.java | 41 + .../implementation/AddressImpl.java | 43 + .../implementation/AddressInner.java | 139 ++ .../implementation/AgreementImpl.java | 96 + .../implementation/AgreementInner.java | 145 ++ .../AgreementListResultImpl.java | 37 + .../AgreementListResultInner.java | 48 + .../implementation/AgreementsImpl.java | 63 + .../implementation/AgreementsInner.java | 378 ++++ .../implementation/AvailableBalanceImpl.java | 47 + .../implementation/AvailableBalanceInner.java | 36 + .../implementation/AvailableBalancesImpl.java | 42 + .../AvailableBalancesInner.java | 143 ++ .../implementation/BillingAccountImpl.java | 200 +++ .../implementation/BillingAccountInner.java | 226 +++ .../BillingAccountListResultImpl.java | 37 + .../BillingAccountListResultInner.java | 48 + .../implementation/BillingAccountsImpl.java | 79 + .../implementation/BillingAccountsInner.java | 752 ++++++++ .../BillingManagementClientImpl.java | 534 ++++++ .../implementation/BillingManager.java | 387 ++++ .../BillingPermissionsImpl.java | 78 + .../BillingPermissionsInner.java | 404 +++++ .../BillingPermissionsListResultImpl.java | 33 + .../BillingPermissionsListResultInner.java | 34 + .../implementation/BillingProfileImpl.java | 237 +++ .../implementation/BillingProfileInner.java | 261 +++ .../BillingProfileListResultImpl.java | 37 + .../BillingProfileListResultInner.java | 48 + .../implementation/BillingProfilesImpl.java | 72 + .../implementation/BillingProfilesInner.java | 734 ++++++++ .../implementation/BillingPropertyImpl.java | 117 ++ .../implementation/BillingPropertyInner.java | 247 +++ .../implementation/BillingPropertysImpl.java | 42 + .../implementation/BillingPropertysInner.java | 132 ++ .../BillingRoleAssignmentImpl.java | 91 + .../BillingRoleAssignmentInner.java | 125 ++ .../BillingRoleAssignmentListResultImpl.java | 32 + .../BillingRoleAssignmentListResultInner.java | 33 + .../BillingRoleAssignmentsImpl.java | 179 ++ .../BillingRoleAssignmentsInner.java | 1171 ++++++++++++ .../BillingRoleDefinitionImpl.java | 73 + .../BillingRoleDefinitionInner.java | 78 + .../BillingRoleDefinitionListResultImpl.java | 32 + .../BillingRoleDefinitionListResultInner.java | 33 + .../BillingRoleDefinitionsImpl.java | 111 ++ .../BillingRoleDefinitionsInner.java | 599 +++++++ .../BillingSubscriptionImpl.java | 132 ++ .../BillingSubscriptionInner.java | 260 +++ .../BillingSubscriptionsImpl.java | 151 ++ .../BillingSubscriptionsInner.java | 1216 +++++++++++++ .../BillingSubscriptionsListResultImpl.java | 37 + .../BillingSubscriptionsListResultInner.java | 48 + ...fileBillingAccountTransferDetailsImpl.java | 108 ++ .../implementation/CustomerImpl.java | 63 + .../implementation/CustomerInner.java | 102 ++ .../implementation/CustomerPolicyImpl.java | 47 + .../implementation/CustomerPolicyInner.java | 49 + .../implementation/CustomersImpl.java | 83 + .../implementation/CustomersInner.java | 942 ++++++++++ .../implementation/DepartmentImpl.java | 85 + .../implementation/DepartmentInner.java | 126 ++ .../DepartmentListResultImpl.java | 37 + .../DepartmentListResultInner.java | 48 + .../implementation/DepartmentsImpl.java | 63 + .../implementation/DepartmentsInner.java | 388 ++++ .../implementation/DownloadUrlImpl.java | 37 + .../implementation/DownloadUrlInner.java | 48 + .../implementation/EnrollmentAccountImpl.java | 98 + .../EnrollmentAccountInner.java | 204 +++ .../EnrollmentAccountListResultImpl.java | 37 + .../EnrollmentAccountListResultInner.java | 48 + .../EnrollmentAccountsImpl.java | 63 + .../EnrollmentAccountsInner.java | 388 ++++ .../implementation/IdParsingUtils.java | 57 + .../implementation/InstructionImpl.java | 139 ++ .../implementation/InstructionInner.java | 125 ++ .../implementation/InstructionsImpl.java | 78 + .../implementation/InstructionsInner.java | 500 ++++++ .../implementation/InvoiceImpl.java | 184 ++ .../implementation/InvoiceInner.java | 416 +++++ .../implementation/InvoiceListResultImpl.java | 37 + .../InvoiceListResultInner.java | 48 + ...fileBillingAccountTransferDetailsImpl.java | 108 ++ .../implementation/InvoiceSectionImpl.java | 111 ++ .../implementation/InvoiceSectionInner.java | 46 + .../InvoiceSectionListResultImpl.java | 37 + .../InvoiceSectionListResultInner.java | 48 + ...iceSectionWithCreateSubPermissionImpl.java | 70 + ...ceSectionWithCreateSubPermissionInner.java | 154 ++ .../implementation/InvoiceSectionsImpl.java | 79 + .../implementation/InvoiceSectionsInner.java | 1025 +++++++++++ .../implementation/InvoicesImpl.java | 118 ++ .../implementation/InvoicesInner.java | 787 ++++++++ .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 59 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 +++ .../implementation/PageImpl.java | 75 + .../implementation/PartnerTransfersImpl.java | 90 + .../implementation/PartnerTransfersInner.java | 605 +++++++ .../implementation/PaymentMethodImpl.java | 66 + .../implementation/PaymentMethodInner.java | 93 + .../implementation/PaymentMethodsImpl.java | 71 + .../implementation/PaymentMethodsInner.java | 531 ++++++ .../implementation/PoliciesImpl.java | 79 + .../implementation/PoliciesInner.java | 501 ++++++ .../implementation/PolicyImpl.java | 59 + .../implementation/PolicyInner.java | 106 ++ .../implementation/PriceSheetsImpl.java | 54 + .../implementation/PriceSheetsInner.java | 390 ++++ .../implementation/ProductImpl.java | 173 ++ .../implementation/ProductInner.java | 382 ++++ .../implementation/ProductsImpl.java | 145 ++ .../implementation/ProductsInner.java | 1373 ++++++++++++++ .../ProductsListResultImpl.java | 37 + .../ProductsListResultInner.java | 49 + .../RecipientTransferDetailsImpl.java | 91 + .../RecipientTransferDetailsInner.java | 208 +++ .../RecipientTransfersImpl.java | 98 + .../RecipientTransfersInner.java | 746 ++++++++ .../implementation/TransactionImpl.java | 219 +++ .../implementation/TransactionInner.java | 572 ++++++ .../TransactionListResultImpl.java | 37 + .../TransactionListResultInner.java | 48 + .../implementation/TransactionsImpl.java | 126 ++ .../implementation/TransactionsInner.java | 1587 +++++++++++++++++ ...TransferBillingSubscriptionResultImpl.java | 31 + ...ransferBillingSubscriptionResultInner.java | 45 + .../implementation/TransferDetailsInner.java | 240 +++ .../implementation/TransfersImpl.java | 89 + .../implementation/TransfersInner.java | 605 +++++++ .../UpdateAutoRenewOperationImpl.java | 32 + .../UpdateAutoRenewOperationInner.java | 46 + .../ValidateAddressResponseImpl.java | 44 + .../ValidateAddressResponseInner.java | 99 + ...eProductTransferEligibilityResultImpl.java | 37 + ...ProductTransferEligibilityResultInner.java | 59 + ...criptionTransferEligibilityResultImpl.java | 37 + ...riptionTransferEligibilityResultInner.java | 59 + .../ValidateTransferListResponseImpl.java | 33 + .../ValidateTransferListResponseInner.java | 34 + .../implementation/package-info.java | 11 + .../v2019_10_01_preview/package-info.java | 11 + 286 files changed, 37537 insertions(+) create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/pom.xml create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AcceptTransferRequest.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AcceptanceMode.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AccountType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Address.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AddressDetails.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AddressValidationStatus.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Agreement.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AgreementListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AgreementType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Agreements.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Amount.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AvailableBalance.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AvailableBalances.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AzurePlan.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccount.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccountListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccountUpdateRequest.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccounts.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingFrequency.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissions.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsProperties.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfile.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileCreationRequest.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileSpendingLimit.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileStatus.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileStatusReasonCode.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfiles.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfilesCreateHeaders.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfilesUpdateHeaders.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProperty.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPropertys.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignment.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignmentListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignmentPayload.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignments.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinition.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinitionListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinitions.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscription.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptionStatusType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptions.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptionsListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptionsTransferHeaders.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Category.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Customer.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerBillingProfileBillingAccountTransferDetails.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerPolicy.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Customers.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Department.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DepartmentListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Departments.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DetailedTransferStatus.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Document.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DocumentType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DownloadUrl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EligibleProductType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Enrollment.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccount.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountContext.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccounts.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentPolicies.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Error.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorDetails.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorResponse.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorResponseException.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InitiateTransferRequest.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Instruction.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Instructions.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Invoice.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSection.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionBillingProfileBillingAccountTransferDetails.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionCreationRequest.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionWithCreateSubPermission.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSections.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionsCreateHeaders.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionsUpdateHeaders.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceStatus.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Invoices.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/MarketplacePurchasesPolicy.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Operation.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/OperationDisplay.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Operations.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Participants.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PartnerTransfers.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethod.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethodFamily.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethodType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethods.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentProperties.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Policies.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Policy.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheetDownloadByBillingProfileHeaders.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheetDownloadHeaders.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheets.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Product.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductDetails.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductStatusType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductTransferStatus.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductTransferValidationErrorCode.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Products.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductsListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductsTransferHeaders.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RebillDocumentType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransferDetails.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransfers.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Reseller.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ReservationPurchasesPolicy.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ReservationType.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/SpendingLimit.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/StatusReasonCode.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/SubscriptionTransferValidationErrorCode.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transaction.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransactionListResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransactionTypeKind.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transactions.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionRequest.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionRequestProperties.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferProductRequestProperties.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferStatus.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transfers.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenew.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenewOperation.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenewRequest.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateAddressResponse.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateProductTransferEligibilityError.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateProductTransferEligibilityResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateSubscriptionTransferEligibilityError.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateSubscriptionTransferEligibilityResult.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateTransferListResponse.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateTransferResponse.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidationResultProperties.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ViewCharges.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ViewChargesPolicy.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AddressImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AddressInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalanceImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalanceInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalancesImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalancesInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManagementClientImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManager.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfilesImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfilesInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertyImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertyInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertysImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertysInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerBillingProfileBillingAccountTransferDetailsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerPolicyImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerPolicyInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomersImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomersInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DownloadUrlImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DownloadUrlInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/IdParsingUtils.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionBillingProfileBillingAccountTransferDetailsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionWithCreateSubPermissionImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionWithCreateSubPermissionInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoicesImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoicesInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PageImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PartnerTransfersImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PartnerTransfersInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PoliciesImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PoliciesInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PolicyImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PolicyInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PriceSheetsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PriceSheetsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransferDetailsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransferDetailsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionListResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionListResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionsImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransferBillingSubscriptionResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransferBillingSubscriptionResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransferDetailsInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransfersImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransfersInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/UpdateAutoRenewOperationImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/UpdateAutoRenewOperationInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateAddressResponseImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateAddressResponseInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateProductTransferEligibilityResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateProductTransferEligibilityResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateTransferListResponseImpl.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateTransferListResponseInner.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/package-info.java create mode 100644 sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/package-info.java diff --git a/sdk/billing/mgmt-v2019_10_01_preview/pom.xml b/sdk/billing/mgmt-v2019_10_01_preview/pom.xml new file mode 100644 index 0000000000000..537ffc29bbe6e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.billing.v2019_10_01_preview + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-billing + 1.0.0-beta + jar + Microsoft Azure SDK for Billing Management + This package contains Microsoft Billing Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AcceptTransferRequest.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AcceptTransferRequest.java new file mode 100644 index 0000000000000..f6c6e1f949c68 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AcceptTransferRequest.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Request parameters to accept transfer. + */ +@JsonFlatten +public class AcceptTransferRequest { + /** + * Request parameters to accept transfer. + */ + @JsonProperty(value = "properties.productDetails") + private List productDetails; + + /** + * Get request parameters to accept transfer. + * + * @return the productDetails value + */ + public List productDetails() { + return this.productDetails; + } + + /** + * Set request parameters to accept transfer. + * + * @param productDetails the productDetails value to set + * @return the AcceptTransferRequest object itself. + */ + public AcceptTransferRequest withProductDetails(List productDetails) { + this.productDetails = productDetails; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AcceptanceMode.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AcceptanceMode.java new file mode 100644 index 0000000000000..75ff55497ea36 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AcceptanceMode.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AcceptanceMode. + */ +public final class AcceptanceMode extends ExpandableStringEnum { + /** Static value ClickToAccept for AcceptanceMode. */ + public static final AcceptanceMode CLICK_TO_ACCEPT = fromString("ClickToAccept"); + + /** Static value ESignEmbedded for AcceptanceMode. */ + public static final AcceptanceMode ESIGN_EMBEDDED = fromString("ESignEmbedded"); + + /** Static value ESignOffline for AcceptanceMode. */ + public static final AcceptanceMode ESIGN_OFFLINE = fromString("ESignOffline"); + + /** + * Creates or finds a AcceptanceMode from its string representation. + * @param name a name to look for + * @return the corresponding AcceptanceMode + */ + @JsonCreator + public static AcceptanceMode fromString(String name) { + return fromString(name, AcceptanceMode.class); + } + + /** + * @return known AcceptanceMode values + */ + public static Collection values() { + return values(AcceptanceMode.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AccountType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AccountType.java new file mode 100644 index 0000000000000..fcd9416e585fe --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AccountType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AccountType. + */ +public final class AccountType extends ExpandableStringEnum { + /** Static value Enterprise for AccountType. */ + public static final AccountType ENTERPRISE = fromString("Enterprise"); + + /** Static value Individual for AccountType. */ + public static final AccountType INDIVIDUAL = fromString("Individual"); + + /** Static value Partner for AccountType. */ + public static final AccountType PARTNER = fromString("Partner"); + + /** + * Creates or finds a AccountType from its string representation. + * @param name a name to look for + * @return the corresponding AccountType + */ + @JsonCreator + public static AccountType fromString(String name) { + return fromString(name, AccountType.class); + } + + /** + * @return known AccountType values + */ + public static Collection values() { + return values(AccountType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Address.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Address.java new file mode 100644 index 0000000000000..2ae7487127a7a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Address.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.AddressInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Address. + */ +public interface Address extends HasInner { + /** + * Validates an address. Use the operation to validate an address before using it as a billing account or a billing profile address. + * + * @param address the AddressDetails value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateAsync(AddressDetails address); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AddressDetails.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AddressDetails.java new file mode 100644 index 0000000000000..fae83bd7a457c --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AddressDetails.java @@ -0,0 +1,277 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Address details. + */ +public class AddressDetails { + /** + * First name. + */ + @JsonProperty(value = "firstName") + private String firstName; + + /** + * Last name. + */ + @JsonProperty(value = "lastName") + private String lastName; + + /** + * Company name. + */ + @JsonProperty(value = "companyName") + private String companyName; + + /** + * Address line 1. + */ + @JsonProperty(value = "addressLine1") + private String addressLine1; + + /** + * Address line 2. + */ + @JsonProperty(value = "addressLine2") + private String addressLine2; + + /** + * Address line 3. + */ + @JsonProperty(value = "addressLine3") + private String addressLine3; + + /** + * Address city. + */ + @JsonProperty(value = "city") + private String city; + + /** + * Address region. + */ + @JsonProperty(value = "region") + private String region; + + /** + * Country code uses ISO2, 2-digit format. + */ + @JsonProperty(value = "country") + private String country; + + /** + * Postal code. + */ + @JsonProperty(value = "postalCode") + private String postalCode; + + /** + * Get first name. + * + * @return the firstName value + */ + public String firstName() { + return this.firstName; + } + + /** + * Set first name. + * + * @param firstName the firstName value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get last name. + * + * @return the lastName value + */ + public String lastName() { + return this.lastName; + } + + /** + * Set last name. + * + * @param lastName the lastName value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get company name. + * + * @return the companyName value + */ + public String companyName() { + return this.companyName; + } + + /** + * Set company name. + * + * @param companyName the companyName value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withCompanyName(String companyName) { + this.companyName = companyName; + return this; + } + + /** + * Get address line 1. + * + * @return the addressLine1 value + */ + public String addressLine1() { + return this.addressLine1; + } + + /** + * Set address line 1. + * + * @param addressLine1 the addressLine1 value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withAddressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + return this; + } + + /** + * Get address line 2. + * + * @return the addressLine2 value + */ + public String addressLine2() { + return this.addressLine2; + } + + /** + * Set address line 2. + * + * @param addressLine2 the addressLine2 value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withAddressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + return this; + } + + /** + * Get address line 3. + * + * @return the addressLine3 value + */ + public String addressLine3() { + return this.addressLine3; + } + + /** + * Set address line 3. + * + * @param addressLine3 the addressLine3 value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withAddressLine3(String addressLine3) { + this.addressLine3 = addressLine3; + return this; + } + + /** + * Get address city. + * + * @return the city value + */ + public String city() { + return this.city; + } + + /** + * Set address city. + * + * @param city the city value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withCity(String city) { + this.city = city; + return this; + } + + /** + * Get address region. + * + * @return the region value + */ + public String region() { + return this.region; + } + + /** + * Set address region. + * + * @param region the region value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withRegion(String region) { + this.region = region; + return this; + } + + /** + * Get country code uses ISO2, 2-digit format. + * + * @return the country value + */ + public String country() { + return this.country; + } + + /** + * Set country code uses ISO2, 2-digit format. + * + * @param country the country value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withCountry(String country) { + this.country = country; + return this; + } + + /** + * Get postal code. + * + * @return the postalCode value + */ + public String postalCode() { + return this.postalCode; + } + + /** + * Set postal code. + * + * @param postalCode the postalCode value to set + * @return the AddressDetails object itself. + */ + public AddressDetails withPostalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AddressValidationStatus.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AddressValidationStatus.java new file mode 100644 index 0000000000000..4d9ea95a8614b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AddressValidationStatus.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AddressValidationStatus. + */ +public final class AddressValidationStatus extends ExpandableStringEnum { + /** Static value Valid for AddressValidationStatus. */ + public static final AddressValidationStatus VALID = fromString("Valid"); + + /** Static value Invalid for AddressValidationStatus. */ + public static final AddressValidationStatus INVALID = fromString("Invalid"); + + /** + * Creates or finds a AddressValidationStatus from its string representation. + * @param name a name to look for + * @return the corresponding AddressValidationStatus + */ + @JsonCreator + public static AddressValidationStatus fromString(String name) { + return fromString(name, AddressValidationStatus.class); + } + + /** + * @return known AddressValidationStatus values + */ + public static Collection values() { + return values(AddressValidationStatus.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Agreement.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Agreement.java new file mode 100644 index 0000000000000..c0b99d0df7ff7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Agreement.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.AgreementInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing Agreement. + */ +public interface Agreement extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the acceptanceMode value. + */ + AcceptanceMode acceptanceMode(); + + /** + * @return the agreementLink value. + */ + String agreementLink(); + + /** + * @return the category value. + */ + Category category(); + + /** + * @return the effectiveDate value. + */ + DateTime effectiveDate(); + + /** + * @return the expirationDate value. + */ + DateTime expirationDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the participants value. + */ + List participants(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AgreementListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AgreementListResult.java new file mode 100644 index 0000000000000..0f4aded018df5 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AgreementListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.AgreementListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.AgreementInner; +import java.util.List; + +/** + * Type representing AgreementListResult. + */ +public interface AgreementListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value 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/AgreementType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AgreementType.java new file mode 100644 index 0000000000000..d3d4eaad6c43c --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AgreementType.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AgreementType. + */ +public final class AgreementType extends ExpandableStringEnum { + /** Static value MicrosoftCustomerAgreement for AgreementType. */ + public static final AgreementType MICROSOFT_CUSTOMER_AGREEMENT = fromString("MicrosoftCustomerAgreement"); + + /** Static value EnterpriseAgreement for AgreementType. */ + public static final AgreementType ENTERPRISE_AGREEMENT = fromString("EnterpriseAgreement"); + + /** Static value MicrosoftOnlineServicesProgram for AgreementType. */ + public static final AgreementType MICROSOFT_ONLINE_SERVICES_PROGRAM = fromString("MicrosoftOnlineServicesProgram"); + + /** Static value MicrosoftPartnerAgreement for AgreementType. */ + public static final AgreementType MICROSOFT_PARTNER_AGREEMENT = fromString("MicrosoftPartnerAgreement"); + + /** + * Creates or finds a AgreementType from its string representation. + * @param name a name to look for + * @return the corresponding AgreementType + */ + @JsonCreator + public static AgreementType fromString(String name) { + return fromString(name, AgreementType.class); + } + + /** + * @return known AgreementType values + */ + public static Collection values() { + return values(AgreementType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Agreements.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Agreements.java new file mode 100644 index 0000000000000..f8cebcb91721d --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Agreements.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.AgreementsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Agreements. + */ +public interface Agreements extends HasInner { + /** + * Lists the agreements for a billing account. + * + * @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(String billingAccountName); + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String agreementName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Amount.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Amount.java new file mode 100644 index 0000000000000..f7a9e2df7b29e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Amount.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * The amount. + */ +public class Amount { + /** + * The currency for the amount value. + */ + @JsonProperty(value = "currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * Amount value. + */ + @JsonProperty(value = "value") + private Double value; + + /** + * Get the currency for the amount value. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get amount value. + * + * @return the value value + */ + public Double value() { + return this.value; + } + + /** + * Set amount value. + * + * @param value the value value to set + * @return the Amount object itself. + */ + public Amount withValue(Double value) { + this.value = value; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AvailableBalance.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AvailableBalance.java new file mode 100644 index 0000000000000..ba04740a32e2f --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AvailableBalance.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; + +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.AvailableBalanceInner; + +/** + * Type representing AvailableBalance. + */ +public interface AvailableBalance extends HasInner, HasManager { + /** + * @return the amount value. + */ + Amount amount(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AvailableBalances.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AvailableBalances.java new file mode 100644 index 0000000000000..4aaba535713fb --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AvailableBalances.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.AvailableBalancesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AvailableBalances. + */ +public interface AvailableBalances extends HasInner { + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only 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 for the request + */ + Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AzurePlan.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AzurePlan.java new file mode 100644 index 0000000000000..95b21833b8d4b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/AzurePlan.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of the Azure plan. + */ +public class AzurePlan { + /** + * The sku id. + */ + @JsonProperty(value = "skuId") + private String skuId; + + /** + * The sku description. + */ + @JsonProperty(value = "skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * Get the sku id. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Set the sku id. + * + * @param skuId the skuId value to set + * @return the AzurePlan object itself. + */ + public AzurePlan withSkuId(String skuId) { + this.skuId = skuId; + return this; + } + + /** + * Get the sku description. + * + * @return the skuDescription value + */ + public String skuDescription() { + return this.skuDescription; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccount.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccount.java new file mode 100644 index 0000000000000..be9863eaa4a68 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccount.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingAccountInner; +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.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingProfileInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.DepartmentInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.EnrollmentAccountInner; + +/** + * Type representing BillingAccount. + */ +public interface BillingAccount extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the accountType value. + */ + AccountType accountType(); + + /** + * @return the address value. + */ + AddressDetails address(); + + /** + * @return the agreementType value. + */ + AgreementType agreementType(); + + /** + * @return the billingProfiles value. + */ + List billingProfiles(); + + /** + * @return the customerType value. + */ + CustomerType customerType(); + + /** + * @return the departments value. + */ + List departments(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enrollmentAccounts value. + */ + List enrollmentAccounts(); + + /** + * @return the enrollmentDetails value. + */ + Enrollment enrollmentDetails(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the organizationId value. + */ + String organizationId(); + + /** + * @return the type value. + */ + String type(); + + /** + * The template for a BillingAccount update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAddress, UpdateStages.WithBillingProfiles, UpdateStages.WithDepartments, UpdateStages.WithEnrollmentAccounts { + } + + /** + * Grouping of BillingAccount update stages. + */ + interface UpdateStages { + /** + * The stage of the billingaccount update allowing to specify Address. + */ + interface WithAddress { + /** + * Specifies address. + * @param address The address associated with the billing account + * @return the next update stage + */ + Update withAddress(AddressDetails address); + } + + /** + * The stage of the billingaccount update allowing to specify BillingProfiles. + */ + interface WithBillingProfiles { + /** + * Specifies billingProfiles. + * @param billingProfiles The billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand + * @return the next update stage + */ + Update withBillingProfiles(List billingProfiles); + } + + /** + * The stage of the billingaccount update allowing to specify Departments. + */ + interface WithDepartments { + /** + * Specifies departments. + * @param departments The departments associated to the enrollment + * @return the next update stage + */ + Update withDepartments(List departments); + } + + /** + * The stage of the billingaccount update allowing to specify EnrollmentAccounts. + */ + interface WithEnrollmentAccounts { + /** + * Specifies enrollmentAccounts. + * @param enrollmentAccounts The accounts associated to the enrollment + * @return the next update stage + */ + Update withEnrollmentAccounts(List enrollmentAccounts); + } + + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccountListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccountListResult.java new file mode 100644 index 0000000000000..381d33ccc6fc7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccountListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.BillingAccountListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingAccountInner; +import java.util.List; + +/** + * Type representing BillingAccountListResult. + */ +public interface BillingAccountListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value 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/BillingAccountUpdateRequest.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccountUpdateRequest.java new file mode 100644 index 0000000000000..926068ef93b5d --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccountUpdateRequest.java @@ -0,0 +1,223 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingProfileInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.DepartmentInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.EnrollmentAccountInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The request properties of the billing account that can be updated. + */ +@JsonFlatten +public class BillingAccountUpdateRequest { + /** + * The billing account name. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The address associated with the billing account. + */ + @JsonProperty(value = "properties.address") + private AddressDetails address; + + /** + * The type of agreement. Possible values include: + * 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + * 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement'. + */ + @JsonProperty(value = "properties.agreementType", access = JsonProperty.Access.WRITE_ONLY) + private AgreementType agreementType; + + /** + * The type of customer. Possible values include: 'Enterprise', + * 'Individual', 'Partner'. + */ + @JsonProperty(value = "properties.customerType", access = JsonProperty.Access.WRITE_ONLY) + private CustomerType customerType; + + /** + * The type of customer. Possible values include: 'Enterprise', + * 'Individual', 'Partner'. + */ + @JsonProperty(value = "properties.accountType", access = JsonProperty.Access.WRITE_ONLY) + private AccountType accountType; + + /** + * The billing profiles associated with the billing account. By default + * this is not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.billingProfiles") + private List billingProfiles; + + /** + * The details about the associated legacy enrollment. By default this is + * not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.enrollmentDetails", access = JsonProperty.Access.WRITE_ONLY) + private Enrollment enrollmentDetails; + + /** + * The departments associated to the enrollment. + */ + @JsonProperty(value = "properties.departments") + private List departments; + + /** + * The accounts associated to the enrollment. + */ + @JsonProperty(value = "properties.enrollmentAccounts") + private List enrollmentAccounts; + + /** + * Organization id. + */ + @JsonProperty(value = "properties.organizationId", access = JsonProperty.Access.WRITE_ONLY) + private String organizationId; + + /** + * Get the billing account name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the address associated with the billing account. + * + * @return the address value + */ + public AddressDetails address() { + return this.address; + } + + /** + * Set the address associated with the billing account. + * + * @param address the address value to set + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withAddress(AddressDetails address) { + this.address = address; + return this; + } + + /** + * Get the type of agreement. Possible values include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement'. + * + * @return the agreementType value + */ + public AgreementType agreementType() { + return this.agreementType; + } + + /** + * Get the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner'. + * + * @return the customerType value + */ + public CustomerType customerType() { + return this.customerType; + } + + /** + * Get the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner'. + * + * @return the accountType value + */ + public AccountType accountType() { + return this.accountType; + } + + /** + * Get the billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. + * + * @return the billingProfiles value + */ + public List billingProfiles() { + return this.billingProfiles; + } + + /** + * Set the billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. + * + * @param billingProfiles the billingProfiles value to set + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withBillingProfiles(List billingProfiles) { + this.billingProfiles = billingProfiles; + return this; + } + + /** + * Get the details about the associated legacy enrollment. By default this is not populated, unless it's specified in $expand. + * + * @return the enrollmentDetails value + */ + public Enrollment enrollmentDetails() { + return this.enrollmentDetails; + } + + /** + * Get the departments associated to the enrollment. + * + * @return the departments value + */ + public List departments() { + return this.departments; + } + + /** + * Set the departments associated to the enrollment. + * + * @param departments the departments value to set + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withDepartments(List departments) { + this.departments = departments; + return this; + } + + /** + * Get the accounts associated to the enrollment. + * + * @return the enrollmentAccounts value + */ + public List enrollmentAccounts() { + return this.enrollmentAccounts; + } + + /** + * Set the accounts associated to the enrollment. + * + * @param enrollmentAccounts the enrollmentAccounts value to set + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withEnrollmentAccounts(List enrollmentAccounts) { + this.enrollmentAccounts = enrollmentAccounts; + return this; + } + + /** + * Get organization id. + * + * @return the organizationId value + */ + public String organizationId() { + return this.organizationId; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccounts.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccounts.java new file mode 100644 index 0000000000000..b311679d017d7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingAccounts.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingAccountsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingAccounts. + */ +public interface BillingAccounts extends HasInner { + /** + * Gets a billing account by its ID. + * + * @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 getAsync(String billingAccountName); + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer 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 listInvoiceSectionsByCreateSubscriptionPermissionAsync(final String billingAccountName); + + /** + * Lists the billing accounts that a user has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingFrequency.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingFrequency.java new file mode 100644 index 0000000000000..86115830fc09b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingFrequency.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingFrequency. + */ +public final class BillingFrequency extends ExpandableStringEnum { + /** Static value OneTime for BillingFrequency. */ + public static final BillingFrequency ONE_TIME = fromString("OneTime"); + + /** Static value Monthly for BillingFrequency. */ + public static final BillingFrequency MONTHLY = fromString("Monthly"); + + /** Static value UsageBased for BillingFrequency. */ + public static final BillingFrequency USAGE_BASED = fromString("UsageBased"); + + /** + * Creates or finds a BillingFrequency from its string representation. + * @param name a name to look for + * @return the corresponding BillingFrequency + */ + @JsonCreator + public static BillingFrequency fromString(String name) { + return fromString(name, BillingFrequency.class); + } + + /** + * @return known BillingFrequency values + */ + public static Collection values() { + return values(BillingFrequency.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissions.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissions.java new file mode 100644 index 0000000000000..5b929875cd601 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissions.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; + +/** + * Type representing BillingPermissions. + */ +public interface BillingPermissions { + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomerAsync(String billingAccountName, String customerName); + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @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(String billingAccountName); + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @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 for the request + */ + Observable listByInvoiceSectionsAsync(String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @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 for the request + */ + Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName); + +} 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 new file mode 100644 index 0000000000000..3a05157962c89 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsListResult.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.BillingPermissionsListResultInner; +import java.util.List; + +/** + * Type representing BillingPermissionsListResult. + */ +public interface BillingPermissionsListResult extends HasInner, HasManager { + /** + * @return the value 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 new file mode 100644 index 0000000000000..b3af534f7fce4 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPermissionsProperties.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of allowed action and not allowed actions a caller has on a billing + * account. + */ +public class BillingPermissionsProperties { + /** + * The set of actions that the caller is allowed to 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/BillingProfile.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfile.java new file mode 100644 index 0000000000000..29874d286d891 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfile.java @@ -0,0 +1,276 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingProfileInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.InvoiceSectionInner; + +/** + * Type representing BillingProfile. + */ +public interface BillingProfile extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the address value. + */ + AddressDetails address(); + + /** + * @return the currency value. + */ + String currency(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enabledAzurePlans value. + */ + List enabledAzurePlans(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceDay value. + */ + Integer invoiceDay(); + + /** + * @return the invoiceEmailOptIn value. + */ + Boolean invoiceEmailOptIn(); + + /** + * @return the invoiceSections value. + */ + List invoiceSections(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the poNumber value. + */ + String poNumber(); + + /** + * @return the spendingLimit value. + */ + SpendingLimit spendingLimit(); + + /** + * @return the status value. + */ + Object status(); + + /** + * @return the statusReasonCode value. + */ + StatusReasonCode statusReasonCode(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the BillingProfile definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithBillingAccount, DefinitionStages.WithCreate { + } + + /** + * Grouping of BillingProfile definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a BillingProfile definition. + */ + interface Blank extends WithBillingAccount { + } + + /** + * The stage of the billingprofile definition allowing to specify BillingAccount. + */ + interface WithBillingAccount { + /** + * Specifies billingAccountName. + * @param billingAccountName The ID that uniquely identifies a billing account + * @return the next definition stage + */ + WithCreate withExistingBillingAccount(String billingAccountName); + } + + /** + * The stage of the billingprofile definition allowing to specify Address. + */ + interface WithAddress { + /** + * Specifies address. + * @param address Billing address + * @return the next definition stage + */ + WithCreate withAddress(AddressDetails address); + } + + /** + * The stage of the billingprofile definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The name of the billing profile + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the billingprofile definition allowing to specify EnabledAzurePlans. + */ + interface WithEnabledAzurePlans { + /** + * Specifies enabledAzurePlans. + * @param enabledAzurePlans Enabled azure plans for the billing profile + * @return the next definition stage + */ + WithCreate withEnabledAzurePlans(List enabledAzurePlans); + } + + /** + * The stage of the billingprofile definition allowing to specify InvoiceEmailOptIn. + */ + interface WithInvoiceEmailOptIn { + /** + * Specifies invoiceEmailOptIn. + * @param invoiceEmailOptIn Flag controlling whether the invoices for the billing profile are sent through email + * @return the next definition stage + */ + WithCreate withInvoiceEmailOptIn(Boolean invoiceEmailOptIn); + } + + /** + * The stage of the billingprofile definition allowing to specify PoNumber. + */ + interface WithPoNumber { + /** + * Specifies poNumber. + * @param poNumber The purchase order name that will appear on the invoices generated for the billing profile + * @return the next definition stage + */ + WithCreate withPoNumber(String poNumber); + } + + /** + * 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.WithAddress, DefinitionStages.WithDisplayName, DefinitionStages.WithEnabledAzurePlans, DefinitionStages.WithInvoiceEmailOptIn, DefinitionStages.WithPoNumber { + } + } + /** + * The template for a BillingProfile update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAddress, UpdateStages.WithDisplayName, UpdateStages.WithEnabledAzurePlans, UpdateStages.WithInvoiceEmailOptIn, UpdateStages.WithInvoiceSections, UpdateStages.WithPoNumber { + } + + /** + * Grouping of BillingProfile update stages. + */ + interface UpdateStages { + /** + * The stage of the billingprofile update allowing to specify Address. + */ + interface WithAddress { + /** + * Specifies address. + * @param address Billing address + * @return the next update stage + */ + Update withAddress(AddressDetails address); + } + + /** + * The stage of the billingprofile update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The name of the billing profile + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the billingprofile update allowing to specify EnabledAzurePlans. + */ + interface WithEnabledAzurePlans { + /** + * Specifies enabledAzurePlans. + * @param enabledAzurePlans Information about the enabled azure plans + * @return the next update stage + */ + Update withEnabledAzurePlans(List enabledAzurePlans); + } + + /** + * The stage of the billingprofile update allowing to specify InvoiceEmailOptIn. + */ + interface WithInvoiceEmailOptIn { + /** + * Specifies invoiceEmailOptIn. + * @param invoiceEmailOptIn Flag controlling whether the invoices for the billing profile are sent through email + * @return the next update stage + */ + Update withInvoiceEmailOptIn(Boolean invoiceEmailOptIn); + } + + /** + * The stage of the billingprofile update allowing to specify InvoiceSections. + */ + interface WithInvoiceSections { + /** + * Specifies invoiceSections. + * @param invoiceSections The invoice sections associated to the billing profile + * @return the next update stage + */ + Update withInvoiceSections(List invoiceSections); + } + + /** + * The stage of the billingprofile update allowing to specify PoNumber. + */ + interface WithPoNumber { + /** + * Specifies poNumber. + * @param poNumber The purchase order name that will appear on the invoices generated for the billing profile + * @return the next update stage + */ + Update withPoNumber(String poNumber); + } + + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileCreationRequest.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileCreationRequest.java new file mode 100644 index 0000000000000..d1eab423a8e61 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileCreationRequest.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The request parameters for creating a new billing profile. + */ +public class BillingProfileCreationRequest { + /** + * The name of the billing profile. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The purchase order name that will appear on the invoices generated for + * the billing profile. + */ + @JsonProperty(value = "poNumber") + private String poNumber; + + /** + * Billing address. + */ + @JsonProperty(value = "address") + private AddressDetails address; + + /** + * Flag controlling whether the invoices for the billing profile are sent + * through email. + */ + @JsonProperty(value = "invoiceEmailOptIn") + private Boolean invoiceEmailOptIn; + + /** + * Enabled azure plans for the billing profile. + */ + @JsonProperty(value = "enabledAzurePlans") + private List enabledAzurePlans; + + /** + * Get the name of the billing profile. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the billing profile. + * + * @param displayName the displayName value to set + * @return the BillingProfileCreationRequest object itself. + */ + public BillingProfileCreationRequest withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the purchase order name that will appear on the invoices generated for the billing profile. + * + * @return the poNumber value + */ + public String poNumber() { + return this.poNumber; + } + + /** + * Set the purchase order name that will appear on the invoices generated for the billing profile. + * + * @param poNumber the poNumber value to set + * @return the BillingProfileCreationRequest object itself. + */ + public BillingProfileCreationRequest withPoNumber(String poNumber) { + this.poNumber = poNumber; + return this; + } + + /** + * Get billing address. + * + * @return the address value + */ + public AddressDetails address() { + return this.address; + } + + /** + * Set billing address. + * + * @param address the address value to set + * @return the BillingProfileCreationRequest object itself. + */ + public BillingProfileCreationRequest withAddress(AddressDetails address) { + this.address = address; + return this; + } + + /** + * Get flag controlling whether the invoices for the billing profile are sent through email. + * + * @return the invoiceEmailOptIn value + */ + public Boolean invoiceEmailOptIn() { + return this.invoiceEmailOptIn; + } + + /** + * Set flag controlling whether the invoices for the billing profile are sent through email. + * + * @param invoiceEmailOptIn the invoiceEmailOptIn value to set + * @return the BillingProfileCreationRequest object itself. + */ + public BillingProfileCreationRequest withInvoiceEmailOptIn(Boolean invoiceEmailOptIn) { + this.invoiceEmailOptIn = invoiceEmailOptIn; + return this; + } + + /** + * Get enabled azure plans for the billing profile. + * + * @return the enabledAzurePlans value + */ + public List enabledAzurePlans() { + return this.enabledAzurePlans; + } + + /** + * Set enabled azure plans for the billing profile. + * + * @param enabledAzurePlans the enabledAzurePlans value to set + * @return the BillingProfileCreationRequest object itself. + */ + public BillingProfileCreationRequest withEnabledAzurePlans(List enabledAzurePlans) { + this.enabledAzurePlans = enabledAzurePlans; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileListResult.java new file mode 100644 index 0000000000000..464f5824ab3ff --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.BillingProfileListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingProfileInner; +import java.util.List; + +/** + * Type representing BillingProfileListResult. + */ +public interface BillingProfileListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value 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/BillingProfileSpendingLimit.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileSpendingLimit.java new file mode 100644 index 0000000000000..88d6638725ee2 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileSpendingLimit.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingProfileSpendingLimit. + */ +public final class BillingProfileSpendingLimit extends ExpandableStringEnum { + /** Static value Off for BillingProfileSpendingLimit. */ + public static final BillingProfileSpendingLimit OFF = fromString("Off"); + + /** Static value On for BillingProfileSpendingLimit. */ + public static final BillingProfileSpendingLimit ON = fromString("On"); + + /** + * Creates or finds a BillingProfileSpendingLimit from its string representation. + * @param name a name to look for + * @return the corresponding BillingProfileSpendingLimit + */ + @JsonCreator + public static BillingProfileSpendingLimit fromString(String name) { + return fromString(name, BillingProfileSpendingLimit.class); + } + + /** + * @return known BillingProfileSpendingLimit values + */ + public static Collection values() { + return values(BillingProfileSpendingLimit.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileStatus.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileStatus.java new file mode 100644 index 0000000000000..614f06114d8bc --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileStatus.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingProfileStatus. + */ +public final class BillingProfileStatus extends ExpandableStringEnum { + /** Static value Active for BillingProfileStatus. */ + public static final BillingProfileStatus ACTIVE = fromString("Active"); + + /** Static value Disabled for BillingProfileStatus. */ + public static final BillingProfileStatus DISABLED = fromString("Disabled"); + + /** Static value Warned for BillingProfileStatus. */ + public static final BillingProfileStatus WARNED = fromString("Warned"); + + /** + * Creates or finds a BillingProfileStatus from its string representation. + * @param name a name to look for + * @return the corresponding BillingProfileStatus + */ + @JsonCreator + public static BillingProfileStatus fromString(String name) { + return fromString(name, BillingProfileStatus.class); + } + + /** + * @return known BillingProfileStatus values + */ + public static Collection values() { + return values(BillingProfileStatus.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileStatusReasonCode.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileStatusReasonCode.java new file mode 100644 index 0000000000000..ead3dbf223807 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfileStatusReasonCode.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingProfileStatusReasonCode. + */ +public final class BillingProfileStatusReasonCode extends ExpandableStringEnum { + /** Static value PastDue for BillingProfileStatusReasonCode. */ + public static final BillingProfileStatusReasonCode PAST_DUE = fromString("PastDue"); + + /** Static value SpendingLimitReached for BillingProfileStatusReasonCode. */ + public static final BillingProfileStatusReasonCode SPENDING_LIMIT_REACHED = fromString("SpendingLimitReached"); + + /** Static value SpendingLimitExpired for BillingProfileStatusReasonCode. */ + public static final BillingProfileStatusReasonCode SPENDING_LIMIT_EXPIRED = fromString("SpendingLimitExpired"); + + /** + * Creates or finds a BillingProfileStatusReasonCode from its string representation. + * @param name a name to look for + * @return the corresponding BillingProfileStatusReasonCode + */ + @JsonCreator + public static BillingProfileStatusReasonCode fromString(String name) { + return fromString(name, BillingProfileStatusReasonCode.class); + } + + /** + * @return known BillingProfileStatusReasonCode values + */ + public static Collection values() { + return values(BillingProfileStatusReasonCode.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfiles.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfiles.java new file mode 100644 index 0000000000000..1250f85c80005 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfiles.java @@ -0,0 +1,39 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingProfilesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingProfiles. + */ +public interface BillingProfiles extends SupportsCreating, HasInner { + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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(String billingAccountName); + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfilesCreateHeaders.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfilesCreateHeaders.java new file mode 100644 index 0000000000000..82ab45a89c684 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfilesCreateHeaders.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Create operation. + */ +public class BillingProfilesCreateHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommended time to wait before making another request to check the + * status of the operation. The time is specified in seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the BillingProfilesCreateHeaders object itself. + */ + public BillingProfilesCreateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the BillingProfilesCreateHeaders object itself. + */ + public BillingProfilesCreateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfilesUpdateHeaders.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfilesUpdateHeaders.java new file mode 100644 index 0000000000000..5ed2200818782 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProfilesUpdateHeaders.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Update operation. + */ +public class BillingProfilesUpdateHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the BillingProfilesUpdateHeaders object itself. + */ + public BillingProfilesUpdateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the BillingProfilesUpdateHeaders object itself. + */ + public BillingProfilesUpdateHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProperty.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProperty.java new file mode 100644 index 0000000000000..8ee9b647e1955 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingProperty.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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.BillingPropertyInner; + +/** + * Type representing BillingProperty. + */ +public interface BillingProperty extends HasInner, HasManager { + /** + * @return the billingAccountDisplayName value. + */ + String billingAccountDisplayName(); + + /** + * @return the billingAccountId value. + */ + String billingAccountId(); + + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the billingProfileSpendingLimit value. + */ + Object billingProfileSpendingLimit(); + + /** + * @return the billingProfileStatus value. + */ + BillingProfileStatus billingProfileStatus(); + + /** + * @return the billingProfileStatusReasonCode value. + */ + Object billingProfileStatusReasonCode(); + + /** + * @return the billingTenantId value. + */ + String billingTenantId(); + + /** + * @return the costCenter value. + */ + String costCenter(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the productId value. + */ + String productId(); + + /** + * @return the productName value. + */ + String productName(); + + /** + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * @return the skuId value. + */ + String skuId(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPropertys.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPropertys.java new file mode 100644 index 0000000000000..11eaa19e480da --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingPropertys.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingPropertysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingPropertys. + */ +public interface BillingPropertys extends HasInner { + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(); + +} 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/BillingRoleAssignment.java new file mode 100644 index 0000000000000..7db03d45f45f3 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignment.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; + +/** + * Type representing BillingRoleAssignment. + */ +public interface BillingRoleAssignment extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the billingRoleAssignmentName value. + */ + String billingRoleAssignmentName(); + + /** + * @return the createdByPrincipalId value. + */ + String createdByPrincipalId(); + + /** + * @return the createdByPrincipalTenantId value. + */ + String createdByPrincipalTenantId(); + + /** + * @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 roleDefinitionName value. + */ + String roleDefinitionName(); + + /** + * @return the scope value. + */ + String scope(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignmentListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignmentListResult.java new file mode 100644 index 0000000000000..579cd3330cb8f --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignmentListResult.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.BillingRoleAssignmentListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingRoleAssignmentInner; +import java.util.List; + +/** + * Type representing BillingRoleAssignmentListResult. + */ +public interface BillingRoleAssignmentListResult extends HasInner, HasManager { + /** + * @return the value 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/BillingRoleAssignmentPayload.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignmentPayload.java new file mode 100644 index 0000000000000..68f652825a3b9 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignmentPayload.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * The payload use to update role assignment on a scope. + */ +public class BillingRoleAssignmentPayload { + /** + * The user's principal id that the role gets assigned to. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /** + * The role definition id. + */ + @JsonProperty(value = "billingRoleDefinitionId") + private String billingRoleDefinitionId; + + /** + * Get the user's principal id that the role gets assigned to. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the user's principal id that the role gets assigned to. + * + * @param principalId the principalId value to set + * @return the BillingRoleAssignmentPayload object itself. + */ + public BillingRoleAssignmentPayload withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the role definition id. + * + * @return the billingRoleDefinitionId value + */ + public String billingRoleDefinitionId() { + return this.billingRoleDefinitionId; + } + + /** + * Set the role definition id. + * + * @param billingRoleDefinitionId the billingRoleDefinitionId value to set + * @return the BillingRoleAssignmentPayload object itself. + */ + public BillingRoleAssignmentPayload withBillingRoleDefinitionId(String billingRoleDefinitionId) { + this.billingRoleDefinitionId = billingRoleDefinitionId; + return this; + } + +} 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 new file mode 100644 index 0000000000000..50c3d73f886fb --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleAssignments.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingRoleAssignmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingRoleAssignments. + */ +public interface BillingRoleAssignments extends HasInner { + /** + * Gets a role assignment 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 billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + 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. + * + * @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 billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 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. + * + * @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(String billingAccountName); + + /** + * 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 for the request + */ + Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * 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 for the request + */ + Observable 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. + * + * @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); + + /** + * 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. + * + * @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 + */ + Completable deleteByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName); + + /** + * 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 parameters Request parameters that are provided to the create billing role assignment operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable addByBillingAccountAsync(String billingAccountName, BillingRoleAssignmentPayload parameters); + + /** + * 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 for the request + */ + Observable addByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentPayload parameters); + + /** + * 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 for the request + */ + Observable addByBillingProfileAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinition.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinition.java new file mode 100644 index 0000000000000..cbb4a5bf0a7f2 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinition.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingRoleDefinitionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import java.util.List; + +/** + * Type representing BillingRoleDefinition. + */ +public interface BillingRoleDefinition extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the permissions value. + */ + List permissions(); + + /** + * @return the roleName value. + */ + String roleName(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinitionListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinitionListResult.java new file mode 100644 index 0000000000000..de4f300bbe462 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinitionListResult.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.BillingRoleDefinitionListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingRoleDefinitionInner; +import java.util.List; + +/** + * Type representing BillingRoleDefinitionListResult. + */ +public interface BillingRoleDefinitionListResult extends HasInner, HasManager { + /** + * @return the value 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/BillingRoleDefinitions.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinitions.java new file mode 100644 index 0000000000000..9321c3f5fc714 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingRoleDefinitions.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingRoleDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingRoleDefinitions. + */ +public interface BillingRoleDefinitions extends HasInner { + /** + * Gets the definition for a role on an invoice section. The operation is supported only 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 billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName); + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 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. + * + * @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(String billingAccountName); + + /** + * 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. + * + * @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 for the request + */ + Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 for the request + */ + Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName); + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing 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 getByBillingAccountAsync(String billingAccountName, String billingRoleDefinitionName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscription.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscription.java new file mode 100644 index 0000000000000..03cae8d6c84cb --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscription.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingSubscriptionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import java.util.UUID; + +/** + * Type representing BillingSubscription. + */ +public interface BillingSubscription extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * @return the customerId value. + */ + String customerId(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the lastMonthCharges value. + */ + Amount lastMonthCharges(); + + /** + * @return the monthToDateCharges value. + */ + Amount monthToDateCharges(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reseller value. + */ + Reseller reseller(); + + /** + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * @return the skuId value. + */ + String skuId(); + + /** + * @return the subscriptionBillingStatus value. + */ + BillingSubscriptionStatusType subscriptionBillingStatus(); + + /** + * @return the subscriptionId value. + */ + UUID subscriptionId(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptionStatusType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptionStatusType.java new file mode 100644 index 0000000000000..bc9b2cf08b79d --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptionStatusType.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for BillingSubscriptionStatusType. + */ +public final class BillingSubscriptionStatusType extends ExpandableStringEnum { + /** Static value Active for BillingSubscriptionStatusType. */ + public static final BillingSubscriptionStatusType ACTIVE = fromString("Active"); + + /** Static value Inactive for BillingSubscriptionStatusType. */ + public static final BillingSubscriptionStatusType INACTIVE = fromString("Inactive"); + + /** Static value Abandoned for BillingSubscriptionStatusType. */ + public static final BillingSubscriptionStatusType ABANDONED = fromString("Abandoned"); + + /** Static value Deleted for BillingSubscriptionStatusType. */ + public static final BillingSubscriptionStatusType DELETED = fromString("Deleted"); + + /** Static value Warning for BillingSubscriptionStatusType. */ + public static final BillingSubscriptionStatusType WARNING = fromString("Warning"); + + /** + * Creates or finds a BillingSubscriptionStatusType from its string representation. + * @param name a name to look for + * @return the corresponding BillingSubscriptionStatusType + */ + @JsonCreator + public static BillingSubscriptionStatusType fromString(String name) { + return fromString(name, BillingSubscriptionStatusType.class); + } + + /** + * @return known BillingSubscriptionStatusType values + */ + public static Collection values() { + return values(BillingSubscriptionStatusType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptions.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptions.java new file mode 100644 index 0000000000000..da0498c998b66 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptions.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingSubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingSubscriptions. + */ +public interface BillingSubscriptions extends HasInner { + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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); + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 for the request + */ + Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName); + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only 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 for the request + */ + Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Gets a subscription by its ID. The operation is supported only 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName); + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the transfer product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable transferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters); + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the validate transfer eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateTransferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters); + + /** + * Gets a subscription by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByCustomerAsync(String billingAccountName, String customerName, String billingSubscriptionName); + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomerAsync(final String billingAccountName, final String customerName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptionsListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptionsListResult.java new file mode 100644 index 0000000000000..efa0aa2a9c058 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptionsListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.BillingSubscriptionsListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingSubscriptionInner; +import java.util.List; + +/** + * Type representing BillingSubscriptionsListResult. + */ +public interface BillingSubscriptionsListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value 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/BillingSubscriptionsTransferHeaders.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptionsTransferHeaders.java new file mode 100644 index 0000000000000..735baf541dd35 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/BillingSubscriptionsTransferHeaders.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Transfer operation. + */ +public class BillingSubscriptionsTransferHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommended time to wait before making another request to check the + * status of the operation. The time is specified in seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the BillingSubscriptionsTransferHeaders object itself. + */ + public BillingSubscriptionsTransferHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the BillingSubscriptionsTransferHeaders object itself. + */ + public BillingSubscriptionsTransferHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Category.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Category.java new file mode 100644 index 0000000000000..fc9e457222c2f --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Category.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Category. + */ +public final class Category extends ExpandableStringEnum { + /** Static value MicrosoftCustomerAgreement for Category. */ + public static final Category MICROSOFT_CUSTOMER_AGREEMENT = fromString("MicrosoftCustomerAgreement"); + + /** Static value AffiliatePurchaseTerms for Category. */ + public static final Category AFFILIATE_PURCHASE_TERMS = fromString("AffiliatePurchaseTerms"); + + /** Static value Other for Category. */ + public static final Category OTHER = fromString("Other"); + + /** + * Creates or finds a Category from its string representation. + * @param name a name to look for + * @return the corresponding Category + */ + @JsonCreator + public static Category fromString(String name) { + return fromString(name, Category.class); + } + + /** + * @return known Category values + */ + public static Collection values() { + return values(Category.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Customer.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Customer.java new file mode 100644 index 0000000000000..d868c4c634207 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Customer.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.CustomerInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import java.util.List; + +/** + * Type representing Customer. + */ +public interface Customer extends HasInner, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enabledAzurePlans value. + */ + List enabledAzurePlans(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resellers value. + */ + List resellers(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerBillingProfileBillingAccountTransferDetails.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerBillingProfileBillingAccountTransferDetails.java new file mode 100644 index 0000000000000..9242786a9b3c8 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerBillingProfileBillingAccountTransferDetails.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +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.TransferDetailsInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing CustomerBillingProfileBillingAccountTransferDetails. + */ +public interface CustomerBillingProfileBillingAccountTransferDetails extends HasInner, HasManager { + /** + * @return the billingAccountId value. + */ + String billingAccountId(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the canceledBy value. + */ + String canceledBy(); + + /** + * @return the creationTime value. + */ + DateTime creationTime(); + + /** + * @return the detailedTransferStatus value. + */ + List detailedTransferStatus(); + + /** + * @return the expirationTime value. + */ + DateTime expirationTime(); + + /** + * @return the initiatorCustomerType value. + */ + String initiatorCustomerType(); + + /** + * @return the initiatorEmailId value. + */ + String initiatorEmailId(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the lastModifiedTime value. + */ + DateTime lastModifiedTime(); + + /** + * @return the recipientEmailId value. + */ + String recipientEmailId(); + + /** + * @return the resellerId value. + */ + String resellerId(); + + /** + * @return the resellerName value. + */ + String resellerName(); + + /** + * @return the transferStatus value. + */ + TransferStatus transferStatus(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerPolicy.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerPolicy.java new file mode 100644 index 0000000000000..17ad6bcffce77 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerPolicy.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; + +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.CustomerPolicyInner; + +/** + * Type representing CustomerPolicy. + */ +public interface CustomerPolicy extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the viewCharges value. + */ + ViewCharges viewCharges(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerType.java new file mode 100644 index 0000000000000..3a5f4935ae2ec --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/CustomerType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CustomerType. + */ +public final class CustomerType extends ExpandableStringEnum { + /** Static value Enterprise for CustomerType. */ + public static final CustomerType ENTERPRISE = fromString("Enterprise"); + + /** Static value Individual for CustomerType. */ + public static final CustomerType INDIVIDUAL = fromString("Individual"); + + /** Static value Partner for CustomerType. */ + public static final CustomerType PARTNER = fromString("Partner"); + + /** + * Creates or finds a CustomerType from its string representation. + * @param name a name to look for + * @return the corresponding CustomerType + */ + @JsonCreator + public static CustomerType fromString(String name) { + return fromString(name, CustomerType.class); + } + + /** + * @return known CustomerType values + */ + public static Collection values() { + return values(CustomerType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Customers.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Customers.java new file mode 100644 index 0000000000000..e3b0b9c1d466e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Customers.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.CustomersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Customers. + */ +public interface Customers extends HasInner { + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner 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); + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String customerName); + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner 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 for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Department.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Department.java new file mode 100644 index 0000000000000..09763d84ada5a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Department.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.DepartmentInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import java.util.List; + +/** + * Type representing Department. + */ +public interface Department extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the costCenter value. + */ + String costCenter(); + + /** + * @return the departmentName value. + */ + String departmentName(); + + /** + * @return the enrollmentAccounts value. + */ + List enrollmentAccounts(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DepartmentListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DepartmentListResult.java new file mode 100644 index 0000000000000..b0c14ee027d31 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DepartmentListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.DepartmentListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.DepartmentInner; +import java.util.List; + +/** + * Type representing DepartmentListResult. + */ +public interface DepartmentListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value 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/Departments.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Departments.java new file mode 100644 index 0000000000000..b628eefdd9caa --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Departments.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.DepartmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Departments. + */ +public interface Departments extends HasInner { + /** + * Lists the departments that a user has access to. The operation is supported only for billing accounts with agreement type 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 listByBillingAccountNameAsync(String billingAccountName); + + /** + * Gets a department by ID. 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 getAsync(String billingAccountName, String departmentName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DetailedTransferStatus.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DetailedTransferStatus.java new file mode 100644 index 0000000000000..34ddf5ec22da7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DetailedTransferStatus.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Detailed transfer status. + */ +public class DetailedTransferStatus { + /** + * Type of product that is transferred. Possible values include: + * 'AzureSubscription', 'AzureReservation'. + */ + @JsonProperty(value = "productType", access = JsonProperty.Access.WRITE_ONLY) + private ProductType productType; + + /** + * The ID of the product that is transferred. + */ + @JsonProperty(value = "productId", access = JsonProperty.Access.WRITE_ONLY) + private String productId; + + /** + * Transfer status. Possible values include: 'NotStarted', 'InProgress', + * 'Completed', 'Failed'. + */ + @JsonProperty(value = "transferStatus", access = JsonProperty.Access.WRITE_ONLY) + private ProductTransferStatus transferStatus; + + /** + * Error details for transfer execution. + */ + @JsonProperty(value = "errorDetails") + private Error errorDetails; + + /** + * Get type of product that is transferred. Possible values include: 'AzureSubscription', 'AzureReservation'. + * + * @return the productType value + */ + public ProductType productType() { + return this.productType; + } + + /** + * Get the ID of the product that is transferred. + * + * @return the productId value + */ + public String productId() { + return this.productId; + } + + /** + * Get transfer status. Possible values include: 'NotStarted', 'InProgress', 'Completed', 'Failed'. + * + * @return the transferStatus value + */ + public ProductTransferStatus transferStatus() { + return this.transferStatus; + } + + /** + * Get error details for transfer execution. + * + * @return the errorDetails value + */ + public Error errorDetails() { + return this.errorDetails; + } + + /** + * Set error details for transfer execution. + * + * @param errorDetails the errorDetails value to set + * @return the DetailedTransferStatus object itself. + */ + public DetailedTransferStatus withErrorDetails(Error errorDetails) { + this.errorDetails = errorDetails; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Document.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Document.java new file mode 100644 index 0000000000000..ea2235216ff2f --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Document.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of a document. + */ +public class Document { + /** + * The type of the document. Possible values include: 'Invoice', + * 'VoidNote', 'TaxReceipt', 'CreditNote'. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private DocumentType kind; + + /** + * Document URL. + */ + @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY) + private String url; + + /** + * Document numbers for an Enterprise Agreement invoice. + */ + @JsonProperty(value = "documentNumbers", access = JsonProperty.Access.WRITE_ONLY) + private List documentNumbers; + + /** + * Get the type of the document. Possible values include: 'Invoice', 'VoidNote', 'TaxReceipt', 'CreditNote'. + * + * @return the kind value + */ + public DocumentType kind() { + return this.kind; + } + + /** + * Get document URL. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Get document numbers for an Enterprise Agreement invoice. + * + * @return the documentNumbers value + */ + public List documentNumbers() { + return this.documentNumbers; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DocumentType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DocumentType.java new file mode 100644 index 0000000000000..746015e609f27 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DocumentType.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DocumentType. + */ +public final class DocumentType extends ExpandableStringEnum { + /** Static value Invoice for DocumentType. */ + public static final DocumentType INVOICE = fromString("Invoice"); + + /** Static value VoidNote for DocumentType. */ + public static final DocumentType VOID_NOTE = fromString("VoidNote"); + + /** Static value TaxReceipt for DocumentType. */ + public static final DocumentType TAX_RECEIPT = fromString("TaxReceipt"); + + /** Static value CreditNote for DocumentType. */ + public static final DocumentType CREDIT_NOTE = fromString("CreditNote"); + + /** + * Creates or finds a DocumentType from its string representation. + * @param name a name to look for + * @return the corresponding DocumentType + */ + @JsonCreator + public static DocumentType fromString(String name) { + return fromString(name, DocumentType.class); + } + + /** + * @return known DocumentType values + */ + public static Collection values() { + return values(DocumentType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DownloadUrl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DownloadUrl.java new file mode 100644 index 0000000000000..875a3bbaafdb7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/DownloadUrl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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.DownloadUrlInner; +import org.joda.time.DateTime; + +/** + * Type representing DownloadUrl. + */ +public interface DownloadUrl extends HasInner, HasManager { + /** + * @return the expiryTime value. + */ + DateTime expiryTime(); + + /** + * @return the url value. + */ + String url(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EligibleProductType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EligibleProductType.java new file mode 100644 index 0000000000000..e30aa4dc2495b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EligibleProductType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for EligibleProductType. + */ +public final class EligibleProductType extends ExpandableStringEnum { + /** Static value DevTestAzureSubscription for EligibleProductType. */ + public static final EligibleProductType DEV_TEST_AZURE_SUBSCRIPTION = fromString("DevTestAzureSubscription"); + + /** Static value StandardAzureSubscription for EligibleProductType. */ + public static final EligibleProductType STANDARD_AZURE_SUBSCRIPTION = fromString("StandardAzureSubscription"); + + /** Static value AzureReservation for EligibleProductType. */ + public static final EligibleProductType AZURE_RESERVATION = fromString("AzureReservation"); + + /** + * Creates or finds a EligibleProductType from its string representation. + * @param name a name to look for + * @return the corresponding EligibleProductType + */ + @JsonCreator + public static EligibleProductType fromString(String name) { + return fromString(name, EligibleProductType.class); + } + + /** + * @return known EligibleProductType values + */ + public static Collection values() { + return values(EligibleProductType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Enrollment.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Enrollment.java new file mode 100644 index 0000000000000..56f8d352bf527 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Enrollment.java @@ -0,0 +1,175 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of an enrollment. + */ +public class Enrollment { + /** + * The start date of the enrollment. + */ + @JsonProperty(value = "startDate") + private DateTime startDate; + + /** + * The end date of the enrollment. + */ + @JsonProperty(value = "endDate") + private DateTime endDate; + + /** + * The billing currency for the enrollment. + */ + @JsonProperty(value = "currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The channel type of the enrollment. + */ + @JsonProperty(value = "channel", access = JsonProperty.Access.WRITE_ONLY) + private String channel; + + /** + * The policies for Enterprise Agreement enrollments. + */ + @JsonProperty(value = "policies", access = JsonProperty.Access.WRITE_ONLY) + private EnrollmentPolicies policies; + + /** + * The language for the enrollment. + */ + @JsonProperty(value = "language", access = JsonProperty.Access.WRITE_ONLY) + private String language; + + /** + * The country code of the enrollment. + */ + @JsonProperty(value = "countryCode", access = JsonProperty.Access.WRITE_ONLY) + private String countryCode; + + /** + * The current status of the enrollment. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The billing cycle for the enrollment. + */ + @JsonProperty(value = "billingCycle", access = JsonProperty.Access.WRITE_ONLY) + private String billingCycle; + + /** + * Get the start date of the enrollment. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set the start date of the enrollment. + * + * @param startDate the startDate value to set + * @return the Enrollment object itself. + */ + public Enrollment withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the end date of the enrollment. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set the end date of the enrollment. + * + * @param endDate the endDate value to set + * @return the Enrollment object itself. + */ + public Enrollment withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get the billing currency for the enrollment. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get the channel type of the enrollment. + * + * @return the channel value + */ + public String channel() { + return this.channel; + } + + /** + * Get the policies for Enterprise Agreement enrollments. + * + * @return the policies value + */ + public EnrollmentPolicies policies() { + return this.policies; + } + + /** + * Get the language for the enrollment. + * + * @return the language value + */ + public String language() { + return this.language; + } + + /** + * Get the country code of the enrollment. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Get the current status of the enrollment. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the billing cycle for the enrollment. + * + * @return the billingCycle value + */ + public String billingCycle() { + return this.billingCycle; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccount.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccount.java new file mode 100644 index 0000000000000..645bcc55edab9 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccount.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.EnrollmentAccountInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; + +/** + * Type representing EnrollmentAccount. + */ +public interface EnrollmentAccount extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the accountName value. + */ + String accountName(); + + /** + * @return the accountOwner value. + */ + String accountOwner(); + + /** + * @return the costCenter value. + */ + String costCenter(); + + /** + * @return the department value. + */ + Department department(); + + /** + * @return the endDate value. + */ + DateTime endDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the startDate value. + */ + DateTime startDate(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountContext.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountContext.java new file mode 100644 index 0000000000000..3a56c3c99bcd3 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountContext.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The enrollment account context. + */ +public class EnrollmentAccountContext { + /** + * The cost center associated with the enrollment account. + */ + @JsonProperty(value = "costCenter") + private String costCenter; + + /** + * The start date of the enrollment account. + */ + @JsonProperty(value = "startDate") + private DateTime startDate; + + /** + * The end date of the enrollment account. + */ + @JsonProperty(value = "endDate") + private DateTime endDate; + + /** + * The ID of the enrollment account. + */ + @JsonProperty(value = "enrollmentAccountName") + private String enrollmentAccountName; + + /** + * Get the cost center associated with the enrollment account. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the cost center associated with the enrollment account. + * + * @param costCenter the costCenter value to set + * @return the EnrollmentAccountContext object itself. + */ + public EnrollmentAccountContext withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the start date of the enrollment account. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set the start date of the enrollment account. + * + * @param startDate the startDate value to set + * @return the EnrollmentAccountContext object itself. + */ + public EnrollmentAccountContext withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the end date of the enrollment account. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set the end date of the enrollment account. + * + * @param endDate the endDate value to set + * @return the EnrollmentAccountContext object itself. + */ + public EnrollmentAccountContext withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get the ID of the enrollment account. + * + * @return the enrollmentAccountName value + */ + public String enrollmentAccountName() { + return this.enrollmentAccountName; + } + + /** + * Set the ID of the enrollment account. + * + * @param enrollmentAccountName the enrollmentAccountName value to set + * @return the EnrollmentAccountContext object itself. + */ + public EnrollmentAccountContext withEnrollmentAccountName(String enrollmentAccountName) { + this.enrollmentAccountName = enrollmentAccountName; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountListResult.java new file mode 100644 index 0000000000000..0571f5c925ccb --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccountListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.EnrollmentAccountListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.EnrollmentAccountInner; +import java.util.List; + +/** + * Type representing EnrollmentAccountListResult. + */ +public interface EnrollmentAccountListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value 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/EnrollmentAccounts.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccounts.java new file mode 100644 index 0000000000000..2043af350c3f6 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentAccounts.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.EnrollmentAccountsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing EnrollmentAccounts. + */ +public interface EnrollmentAccounts extends HasInner { + /** + * Lists the enrollment accounts for a billing account. The operation is supported only for billing accounts with agreement type 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 listByBillingAccountNameAsync(String billingAccountName); + + /** + * Gets an enrollment account by ID. 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 getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentPolicies.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentPolicies.java new file mode 100644 index 0000000000000..6b5bbb34451b4 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/EnrollmentPolicies.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The policies for Enterprise Agreement enrollments. + */ +public class EnrollmentPolicies { + /** + * The policy that controls whether Account Owners can view charges. + */ + @JsonProperty(value = "accountOwnerViewCharges", access = JsonProperty.Access.WRITE_ONLY) + private Boolean accountOwnerViewCharges; + + /** + * The policy that controls whether Department Administrators can view + * charges. + */ + @JsonProperty(value = "departmentAdminViewCharges", access = JsonProperty.Access.WRITE_ONLY) + private Boolean departmentAdminViewCharges; + + /** + * The policy that controls whether Azure marketplace purchases are allowed + * in the enrollment. + */ + @JsonProperty(value = "marketplacesEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean marketplacesEnabled; + + /** + * The policy that controls whether Azure reservation purchases are allowed + * in the enrollment. + */ + @JsonProperty(value = "reservedInstancesEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean reservedInstancesEnabled; + + /** + * Get the policy that controls whether Account Owners can view charges. + * + * @return the accountOwnerViewCharges value + */ + public Boolean accountOwnerViewCharges() { + return this.accountOwnerViewCharges; + } + + /** + * Get the policy that controls whether Department Administrators can view charges. + * + * @return the departmentAdminViewCharges value + */ + public Boolean departmentAdminViewCharges() { + return this.departmentAdminViewCharges; + } + + /** + * Get the policy that controls whether Azure marketplace purchases are allowed in the enrollment. + * + * @return the marketplacesEnabled value + */ + public Boolean marketplacesEnabled() { + return this.marketplacesEnabled; + } + + /** + * Get the policy that controls whether Azure reservation purchases are allowed in the enrollment. + * + * @return the reservedInstancesEnabled value + */ + public Boolean reservedInstancesEnabled() { + return this.reservedInstancesEnabled; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Error.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Error.java new file mode 100644 index 0000000000000..56d2fc1b49630 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Error.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details for transfer execution. + */ +public class Error { + /** + * Error code. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private String errorCode; + + /** + * Error message. + */ + @JsonProperty(value = "errorMessage", access = JsonProperty.Access.WRITE_ONLY) + private String errorMessage; + + /** + * Get error code. + * + * @return the errorCode value + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get error message. + * + * @return the errorMessage value + */ + public String errorMessage() { + return this.errorMessage; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorDetails.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorDetails.java new file mode 100644 index 0000000000000..f231be41fab66 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorDetails.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The target of the particular error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the target of the particular error. + * + * @return the target value + */ + public String target() { + return this.target; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorResponse.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorResponse.java new file mode 100644 index 0000000000000..dcc0014f88b0a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorResponseException.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorResponseException.java new file mode 100644 index 0000000000000..59d8b1a93fa23 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InitiateTransferRequest.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InitiateTransferRequest.java new file mode 100644 index 0000000000000..0f6fc844e0eed --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InitiateTransferRequest.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Request parameters to initiate transfer. + */ +@JsonFlatten +public class InitiateTransferRequest { + /** + * The email ID of the recipient to whom the transfer request is sent. + */ + @JsonProperty(value = "properties.recipientEmailId") + private String recipientEmailId; + + /** + * Optional MPN ID of the reseller for transfer requests that are sent from + * a Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.resellerId") + private String resellerId; + + /** + * Get the email ID of the recipient to whom the transfer request is sent. + * + * @return the recipientEmailId value + */ + public String recipientEmailId() { + return this.recipientEmailId; + } + + /** + * Set the email ID of the recipient to whom the transfer request is sent. + * + * @param recipientEmailId the recipientEmailId value to set + * @return the InitiateTransferRequest object itself. + */ + public InitiateTransferRequest withRecipientEmailId(String recipientEmailId) { + this.recipientEmailId = recipientEmailId; + return this; + } + + /** + * Get optional MPN ID of the reseller for transfer requests that are sent from a Microsoft Partner Agreement billing account. + * + * @return the resellerId value + */ + public String resellerId() { + return this.resellerId; + } + + /** + * Set optional MPN ID of the reseller for transfer requests that are sent from a Microsoft Partner Agreement billing account. + * + * @param resellerId the resellerId value to set + * @return the InitiateTransferRequest object itself. + */ + public InitiateTransferRequest withResellerId(String resellerId) { + this.resellerId = resellerId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Instruction.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Instruction.java new file mode 100644 index 0000000000000..8a7a027907191 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Instruction.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.InstructionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; + +/** + * Type representing Instruction. + */ +public interface Instruction extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the amount value. + */ + double amount(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the endDate value. + */ + DateTime endDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the startDate value. + */ + DateTime startDate(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Instruction definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithBillingProfile, DefinitionStages.WithAmount, DefinitionStages.WithEndDate, DefinitionStages.WithStartDate, DefinitionStages.WithCreate { + } + + /** + * Grouping of Instruction definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Instruction definition. + */ + interface Blank extends WithBillingProfile { + } + + /** + * The stage of the instruction definition allowing to specify BillingProfile. + */ + interface WithBillingProfile { + /** + * Specifies billingAccountName, billingProfileName. + * @param billingAccountName The ID that uniquely identifies a billing account + * @param billingProfileName The ID that uniquely identifies a billing profile + * @return the next definition stage + */ + WithAmount withExistingBillingProfile(String billingAccountName, String billingProfileName); + } + + /** + * The stage of the instruction definition allowing to specify Amount. + */ + interface WithAmount { + /** + * Specifies amount. + * @param amount The amount budgeted for this billing instruction + * @return the next definition stage + */ + WithEndDate withAmount(double amount); + } + + /** + * The stage of the instruction definition allowing to specify EndDate. + */ + interface WithEndDate { + /** + * Specifies endDate. + * @param endDate The date this billing instruction is no longer in effect + * @return the next definition stage + */ + WithStartDate withEndDate(DateTime endDate); + } + + /** + * The stage of the instruction definition allowing to specify StartDate. + */ + interface WithStartDate { + /** + * Specifies startDate. + * @param startDate The date this billing instruction goes into effect + * @return the next definition stage + */ + WithCreate withStartDate(DateTime startDate); + } + + /** + * The stage of the instruction definition allowing to specify CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + * @param creationDate The date this billing instruction was created + * @return the next definition stage + */ + WithCreate withCreationDate(DateTime creationDate); + } + + /** + * 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.WithCreationDate { + } + } + /** + * The template for a Instruction update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCreationDate { + } + + /** + * Grouping of Instruction update stages. + */ + interface UpdateStages { + /** + * The stage of the instruction update allowing to specify CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + * @param creationDate The date this billing instruction was created + * @return the next update stage + */ + Update withCreationDate(DateTime creationDate); + } + + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Instructions.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Instructions.java new file mode 100644 index 0000000000000..d7333c6268c2f --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Instructions.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.InstructionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Instructions. + */ +public interface Instructions extends SupportsCreating, HasInner { + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName, String instructionName); + + /** + * Lists the instructions by billing profile id. + * + * @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 for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Invoice.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Invoice.java new file mode 100644 index 0000000000000..f68e913632a5d --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Invoice.java @@ -0,0 +1,159 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.InvoiceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing Invoice. + */ +public interface Invoice extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the amountDue value. + */ + Amount amountDue(); + + /** + * @return the azurePrepaymentApplied value. + */ + Amount azurePrepaymentApplied(); + + /** + * @return the billedAmount value. + */ + Amount billedAmount(); + + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the creditAmount value. + */ + Amount creditAmount(); + + /** + * @return the documents value. + */ + List documents(); + + /** + * @return the dueDate value. + */ + DateTime dueDate(); + + /** + * @return the freeAzureCreditApplied value. + */ + Amount freeAzureCreditApplied(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceDate value. + */ + DateTime invoiceDate(); + + /** + * @return the invoicePeriodEndDate value. + */ + DateTime invoicePeriodEndDate(); + + /** + * @return the invoicePeriodStartDate value. + */ + DateTime invoicePeriodStartDate(); + + /** + * @return the invoiceType value. + */ + InvoiceType invoiceType(); + + /** + * @return the isMonthlyInvoice value. + */ + Boolean isMonthlyInvoice(); + + /** + * @return the latestInvoiceId value. + */ + String latestInvoiceId(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the payments value. + */ + List payments(); + + /** + * @return the purchaseOrderNumber value. + */ + String purchaseOrderNumber(); + + /** + * @return the rebillDocumentType value. + */ + RebillDocumentType rebillDocumentType(); + + /** + * @return the rebilledInvoiceId value. + */ + String rebilledInvoiceId(); + + /** + * @return the status value. + */ + InvoiceStatus status(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the subTotal value. + */ + Amount subTotal(); + + /** + * @return the taxAmount value. + */ + Amount taxAmount(); + + /** + * @return the totalAmount value. + */ + Amount totalAmount(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceListResult.java new file mode 100644 index 0000000000000..15b3460edaffe --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.InvoiceListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.InvoiceInner; +import java.util.List; + +/** + * Type representing InvoiceListResult. + */ +public interface InvoiceListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value 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/InvoiceSection.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSection.java new file mode 100644 index 0000000000000..be4367989ef8d --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSection.java @@ -0,0 +1,117 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.InvoiceSectionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; + +/** + * Type representing InvoiceSection. + */ +public interface InvoiceSection extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the InvoiceSection definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithBillingProfile, DefinitionStages.WithDisplayName, DefinitionStages.WithCreate { + } + + /** + * Grouping of InvoiceSection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a InvoiceSection definition. + */ + interface Blank extends WithBillingProfile { + } + + /** + * The stage of the invoicesection definition allowing to specify BillingProfile. + */ + interface WithBillingProfile { + /** + * Specifies billingAccountName, billingProfileName. + * @param billingAccountName The ID that uniquely identifies a billing account + * @param billingProfileName The ID that uniquely identifies a billing profile + * @return the next definition stage + */ + WithDisplayName withExistingBillingProfile(String billingAccountName, String billingProfileName); + } + + /** + * The stage of the invoicesection definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The name of the invoice section + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * 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 { + } + } + /** + * The template for a InvoiceSection update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDisplayName { + } + + /** + * Grouping of InvoiceSection update stages. + */ + interface UpdateStages { + /** + * The stage of the invoicesection update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The name of the invoice section + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionBillingProfileBillingAccountTransferDetails.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionBillingProfileBillingAccountTransferDetails.java new file mode 100644 index 0000000000000..3e76cc9436fa5 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionBillingProfileBillingAccountTransferDetails.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +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.TransferDetailsInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing InvoiceSectionBillingProfileBillingAccountTransferDetails. + */ +public interface InvoiceSectionBillingProfileBillingAccountTransferDetails extends HasInner, HasManager { + /** + * @return the billingAccountId value. + */ + String billingAccountId(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the canceledBy value. + */ + String canceledBy(); + + /** + * @return the creationTime value. + */ + DateTime creationTime(); + + /** + * @return the detailedTransferStatus value. + */ + List detailedTransferStatus(); + + /** + * @return the expirationTime value. + */ + DateTime expirationTime(); + + /** + * @return the initiatorCustomerType value. + */ + String initiatorCustomerType(); + + /** + * @return the initiatorEmailId value. + */ + String initiatorEmailId(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the lastModifiedTime value. + */ + DateTime lastModifiedTime(); + + /** + * @return the recipientEmailId value. + */ + String recipientEmailId(); + + /** + * @return the resellerId value. + */ + String resellerId(); + + /** + * @return the resellerName value. + */ + String resellerName(); + + /** + * @return the transferStatus value. + */ + TransferStatus transferStatus(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionCreationRequest.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionCreationRequest.java new file mode 100644 index 0000000000000..090d718be1738 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionCreationRequest.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the invoice section. + */ +public class InvoiceSectionCreationRequest { + /** + * The name of the invoice section. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the name of the invoice section. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the invoice section. + * + * @param displayName the displayName value to set + * @return the InvoiceSectionCreationRequest object itself. + */ + public InvoiceSectionCreationRequest withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionListResult.java new file mode 100644 index 0000000000000..9f08ce4b3d9e6 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.InvoiceSectionListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.InvoiceSectionInner; +import java.util.List; + +/** + * Type representing InvoiceSectionListResult. + */ +public interface InvoiceSectionListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value 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/InvoiceSectionWithCreateSubPermission.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionWithCreateSubPermission.java new file mode 100644 index 0000000000000..027a019cc56ee --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionWithCreateSubPermission.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +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.InvoiceSectionWithCreateSubPermissionInner; +import java.util.List; + +/** + * Type representing InvoiceSectionWithCreateSubPermission. + */ +public interface InvoiceSectionWithCreateSubPermission extends HasInner, HasManager { + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the billingProfileSpendingLimit value. + */ + BillingProfileSpendingLimit billingProfileSpendingLimit(); + + /** + * @return the billingProfileStatus value. + */ + Object billingProfileStatus(); + + /** + * @return the billingProfileStatusReasonCode value. + */ + BillingProfileStatusReasonCode billingProfileStatusReasonCode(); + + /** + * @return the enabledAzurePlans value. + */ + List enabledAzurePlans(); + + /** + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSections.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSections.java new file mode 100644 index 0000000000000..863d2fcb3d820 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSections.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.InvoiceSectionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing InvoiceSections. + */ +public interface InvoiceSections extends SupportsCreating, HasInner { + /** + * Lists the invoice sections that a user has access to. The operation is supported only 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 for the request + */ + Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName); + + /** + * Gives the caller permissions on an invoice section based on their billing profile access. The operation is supported only 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 for the request + */ + Completable elevateToBillingProfileAsync(String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Gets an invoice section by its ID. The operation is supported only 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 for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionsCreateHeaders.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionsCreateHeaders.java new file mode 100644 index 0000000000000..5b96825a17407 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionsCreateHeaders.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Create operation. + */ +public class InvoiceSectionsCreateHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommended time to wait before making another request to check the + * status of the operation. The time is specified in seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the InvoiceSectionsCreateHeaders object itself. + */ + public InvoiceSectionsCreateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the InvoiceSectionsCreateHeaders object itself. + */ + public InvoiceSectionsCreateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionsUpdateHeaders.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionsUpdateHeaders.java new file mode 100644 index 0000000000000..1786f47089f77 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceSectionsUpdateHeaders.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Update operation. + */ +public class InvoiceSectionsUpdateHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the InvoiceSectionsUpdateHeaders object itself. + */ + public InvoiceSectionsUpdateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the InvoiceSectionsUpdateHeaders object itself. + */ + public InvoiceSectionsUpdateHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceStatus.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceStatus.java new file mode 100644 index 0000000000000..2e33e13919f2c --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceStatus.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InvoiceStatus. + */ +public final class InvoiceStatus extends ExpandableStringEnum { + /** Static value Due for InvoiceStatus. */ + public static final InvoiceStatus DUE = fromString("Due"); + + /** Static value OverDue for InvoiceStatus. */ + public static final InvoiceStatus OVER_DUE = fromString("OverDue"); + + /** Static value Paid for InvoiceStatus. */ + public static final InvoiceStatus PAID = fromString("Paid"); + + /** Static value Void for InvoiceStatus. */ + public static final InvoiceStatus VOID = fromString("Void"); + + /** + * Creates or finds a InvoiceStatus from its string representation. + * @param name a name to look for + * @return the corresponding InvoiceStatus + */ + @JsonCreator + public static InvoiceStatus fromString(String name) { + return fromString(name, InvoiceStatus.class); + } + + /** + * @return known InvoiceStatus values + */ + public static Collection values() { + return values(InvoiceStatus.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceType.java new file mode 100644 index 0000000000000..30068d69a4a82 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/InvoiceType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for InvoiceType. + */ +public final class InvoiceType extends ExpandableStringEnum { + /** Static value AzureService for InvoiceType. */ + public static final InvoiceType AZURE_SERVICE = fromString("AzureService"); + + /** Static value AzureMarketplace for InvoiceType. */ + public static final InvoiceType AZURE_MARKETPLACE = fromString("AzureMarketplace"); + + /** Static value AzureSupport for InvoiceType. */ + public static final InvoiceType AZURE_SUPPORT = fromString("AzureSupport"); + + /** + * Creates or finds a InvoiceType from its string representation. + * @param name a name to look for + * @return the corresponding InvoiceType + */ + @JsonCreator + public static InvoiceType fromString(String name) { + return fromString(name, InvoiceType.class); + } + + /** + * @return known InvoiceType values + */ + public static Collection values() { + return values(InvoiceType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Invoices.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Invoices.java new file mode 100644 index 0000000000000..d35b36e033dab --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Invoices.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.InvoicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Invoices. + */ +public interface Invoices extends HasInner { + /** + * Lists the invoices for a billing account for a given start date and end date. 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 periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(String billingAccountName, String periodStartDate, String periodEndDate); + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate); + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName, String invoiceName); + + /** + * Lists the invoices for a subscription. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingSubscriptionAsync(final String billingAccountName, final String billingSubscriptionName, final String periodStartDate, final String periodEndDate); + + /** + * Gets an invoice by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByIdAsync(String billingAccountName, String billingSubscriptionName, String invoiceName); + + /** + * Gets an invoice by billing account name and ID. 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 invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getBillingAccountInvoiceAsync(String billingAccountName, String invoiceName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/MarketplacePurchasesPolicy.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/MarketplacePurchasesPolicy.java new file mode 100644 index 0000000000000..d070012204474 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/MarketplacePurchasesPolicy.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for MarketplacePurchasesPolicy. + */ +public final class MarketplacePurchasesPolicy extends ExpandableStringEnum { + /** Static value AllAllowed for MarketplacePurchasesPolicy. */ + public static final MarketplacePurchasesPolicy ALL_ALLOWED = fromString("AllAllowed"); + + /** Static value OnlyFreeAllowed for MarketplacePurchasesPolicy. */ + public static final MarketplacePurchasesPolicy ONLY_FREE_ALLOWED = fromString("OnlyFreeAllowed"); + + /** Static value NotAllowed for MarketplacePurchasesPolicy. */ + public static final MarketplacePurchasesPolicy NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a MarketplacePurchasesPolicy from its string representation. + * @param name a name to look for + * @return the corresponding MarketplacePurchasesPolicy + */ + @JsonCreator + public static MarketplacePurchasesPolicy fromString(String name) { + return fromString(name, MarketplacePurchasesPolicy.class); + } + + /** + * @return known MarketplacePurchasesPolicy values + */ + public static Collection values() { + return values(MarketplacePurchasesPolicy.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Operation.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Operation.java new file mode 100644 index 0000000000000..3cbb9e6f73709 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/OperationDisplay.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/OperationDisplay.java new file mode 100644 index 0000000000000..4387057e50a57 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/OperationDisplay.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Billing. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed such as invoice and billing + * subscription. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type such as read, write and delete. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Billing. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed such as invoice and billing subscription. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type such as read, write and delete. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Operations.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Operations.java new file mode 100644 index 0000000000000..8762f8f8a4b18 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists the available billing REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Participants.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Participants.java new file mode 100644 index 0000000000000..8e3a74524e563 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Participants.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details about a participant. + */ +public class Participants { + /** + * The acceptance status of the participant. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The date when the status got changed. + */ + @JsonProperty(value = "statusDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime statusDate; + + /** + * The email address of the participant. + */ + @JsonProperty(value = "email", access = JsonProperty.Access.WRITE_ONLY) + private String email; + + /** + * Get the acceptance status of the participant. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the date when the status got changed. + * + * @return the statusDate value + */ + public DateTime statusDate() { + return this.statusDate; + } + + /** + * Get the email address of the participant. + * + * @return the email value + */ + public String email() { + return this.email; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PartnerTransfers.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PartnerTransfers.java new file mode 100644 index 0000000000000..f01115b1871d4 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PartnerTransfers.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.PartnerTransfersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PartnerTransfers. + */ +public interface PartnerTransfers extends HasInner { + /** + * Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName, String customerName, String transferName); + + /** + * Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String billingAccountName, final String billingProfileName, final String customerName); + + /** + * Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String billingAccountName, String billingProfileName, String customerName, String transferName); + + /** + * Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the initiate transfer operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable initiateAsync(String billingAccountName, String billingProfileName, String customerName, InitiateTransferRequest parameters); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethod.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethod.java new file mode 100644 index 0000000000000..b8ec7770f7b28 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethod.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.PaymentMethodInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; + +/** + * Type representing PaymentMethod. + */ +public interface PaymentMethod extends HasInner, HasManager { + /** + * @return the currency value. + */ + String currency(); + + /** + * @return the details value. + */ + String details(); + + /** + * @return the expiration value. + */ + String expiration(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the paymentMethodType value. + */ + PaymentMethodType paymentMethodType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethodFamily.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethodFamily.java new file mode 100644 index 0000000000000..6ea65d90bfd1c --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethodFamily.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PaymentMethodFamily. + */ +public final class PaymentMethodFamily extends ExpandableStringEnum { + /** Static value Credits for PaymentMethodFamily. */ + public static final PaymentMethodFamily CREDITS = fromString("Credits"); + + /** Static value CheckWire for PaymentMethodFamily. */ + public static final PaymentMethodFamily CHECK_WIRE = fromString("CheckWire"); + + /** Static value CreditCard for PaymentMethodFamily. */ + public static final PaymentMethodFamily CREDIT_CARD = fromString("CreditCard"); + + /** Static value None for PaymentMethodFamily. */ + public static final PaymentMethodFamily NONE = fromString("None"); + + /** + * Creates or finds a PaymentMethodFamily from its string representation. + * @param name a name to look for + * @return the corresponding PaymentMethodFamily + */ + @JsonCreator + public static PaymentMethodFamily fromString(String name) { + return fromString(name, PaymentMethodFamily.class); + } + + /** + * @return known PaymentMethodFamily values + */ + public static Collection values() { + return values(PaymentMethodFamily.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethodType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethodType.java new file mode 100644 index 0000000000000..c53c3c5cc27b7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethodType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PaymentMethodType. + */ +public final class PaymentMethodType extends ExpandableStringEnum { + /** Static value Credits for PaymentMethodType. */ + public static final PaymentMethodType CREDITS = fromString("Credits"); + + /** Static value ChequeWire for PaymentMethodType. */ + public static final PaymentMethodType CHEQUE_WIRE = fromString("ChequeWire"); + + /** + * Creates or finds a PaymentMethodType from its string representation. + * @param name a name to look for + * @return the corresponding PaymentMethodType + */ + @JsonCreator + public static PaymentMethodType fromString(String name) { + return fromString(name, PaymentMethodType.class); + } + + /** + * @return known PaymentMethodType values + */ + public static Collection values() { + return values(PaymentMethodType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethods.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethods.java new file mode 100644 index 0000000000000..836f535c155fe --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentMethods.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.PaymentMethodsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PaymentMethods. + */ +public interface PaymentMethods extends HasInner { + /** + * Lists the payment Methods for a billing profile. The operation is supported only 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 for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName); + + /** + * Lists the payment Methods for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer 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/PaymentProperties.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentProperties.java new file mode 100644 index 0000000000000..468957ec8dbb4 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PaymentProperties.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of a payment. + */ +public class PaymentProperties { + /** + * The type of payment. + */ + @JsonProperty(value = "paymentType", access = JsonProperty.Access.WRITE_ONLY) + private String paymentType; + + /** + * The paid amount. + */ + @JsonProperty(value = "amount", access = JsonProperty.Access.WRITE_ONLY) + private Amount amount; + + /** + * The date when the payment was made. + */ + @JsonProperty(value = "date", access = JsonProperty.Access.WRITE_ONLY) + private DateTime dateProperty; + + /** + * The family of payment method. Possible values include: 'Credits', + * 'CheckWire', 'CreditCard', 'None'. + */ + @JsonProperty(value = "paymentMethodFamily") + private PaymentMethodFamily paymentMethodFamily; + + /** + * The type of payment method. + */ + @JsonProperty(value = "paymentMethodType", access = JsonProperty.Access.WRITE_ONLY) + private String paymentMethodType; + + /** + * Get the type of payment. + * + * @return the paymentType value + */ + public String paymentType() { + return this.paymentType; + } + + /** + * Get the paid amount. + * + * @return the amount value + */ + public Amount amount() { + return this.amount; + } + + /** + * Get the date when the payment was made. + * + * @return the dateProperty value + */ + public DateTime dateProperty() { + return this.dateProperty; + } + + /** + * Get the family of payment method. Possible values include: 'Credits', 'CheckWire', 'CreditCard', 'None'. + * + * @return the paymentMethodFamily value + */ + public PaymentMethodFamily paymentMethodFamily() { + return this.paymentMethodFamily; + } + + /** + * Set the family of payment method. Possible values include: 'Credits', 'CheckWire', 'CreditCard', 'None'. + * + * @param paymentMethodFamily the paymentMethodFamily value to set + * @return the PaymentProperties object itself. + */ + public PaymentProperties withPaymentMethodFamily(PaymentMethodFamily paymentMethodFamily) { + this.paymentMethodFamily = paymentMethodFamily; + return this; + } + + /** + * Get the type of payment method. + * + * @return the paymentMethodType value + */ + public String paymentMethodType() { + return this.paymentMethodType; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Policies.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Policies.java new file mode 100644 index 0000000000000..3348fd24a3543 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Policies.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.PolicyInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.PoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Policies. + */ +public interface Policies extends HasInner { + /** + * Lists the policies for a billing profile. This operation is supported only 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 for the request + */ + Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName); + + /** + * Updates the policies for a billing profile. This operation is supported only 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 update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters); + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByCustomerAsync(String billingAccountName, String customerName); + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateCustomerAsync(String billingAccountName, String customerName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Policy.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Policy.java new file mode 100644 index 0000000000000..3b7618628c636 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Policy.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +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.PolicyInner; + +/** + * Type representing Policy. + */ +public interface Policy extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the marketplacePurchases value. + */ + MarketplacePurchasesPolicy marketplacePurchases(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationPurchases value. + */ + ReservationPurchasesPolicy reservationPurchases(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the viewCharges value. + */ + ViewChargesPolicy viewCharges(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheetDownloadByBillingProfileHeaders.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheetDownloadByBillingProfileHeaders.java new file mode 100644 index 0000000000000..cf34904babf7a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheetDownloadByBillingProfileHeaders.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for DownloadByBillingProfile operation. + */ +public class PriceSheetDownloadByBillingProfileHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * The operation entity Id GUID. + */ + @JsonProperty(value = "OData-EntityId") + private String oDataEntityId; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the PriceSheetDownloadByBillingProfileHeaders object itself. + */ + public PriceSheetDownloadByBillingProfileHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the PriceSheetDownloadByBillingProfileHeaders object itself. + */ + public PriceSheetDownloadByBillingProfileHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the operation entity Id GUID. + * + * @return the oDataEntityId value + */ + public String oDataEntityId() { + return this.oDataEntityId; + } + + /** + * Set the operation entity Id GUID. + * + * @param oDataEntityId the oDataEntityId value to set + * @return the PriceSheetDownloadByBillingProfileHeaders object itself. + */ + public PriceSheetDownloadByBillingProfileHeaders withODataEntityId(String oDataEntityId) { + this.oDataEntityId = oDataEntityId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheetDownloadHeaders.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheetDownloadHeaders.java new file mode 100644 index 0000000000000..760a2c76f0181 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheetDownloadHeaders.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Download operation. + */ +public class PriceSheetDownloadHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * The operation entity Id GUID. + */ + @JsonProperty(value = "OData-EntityId") + private String oDataEntityId; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the PriceSheetDownloadHeaders object itself. + */ + public PriceSheetDownloadHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the PriceSheetDownloadHeaders object itself. + */ + public PriceSheetDownloadHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the operation entity Id GUID. + * + * @return the oDataEntityId value + */ + public String oDataEntityId() { + return this.oDataEntityId; + } + + /** + * Set the operation entity Id GUID. + * + * @param oDataEntityId the oDataEntityId value to set + * @return the PriceSheetDownloadHeaders object itself. + */ + public PriceSheetDownloadHeaders withODataEntityId(String oDataEntityId) { + this.oDataEntityId = oDataEntityId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheets.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheets.java new file mode 100644 index 0000000000000..a6add21dcb233 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/PriceSheets.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; + +/** + * Type representing PriceSheets. + */ +public interface PriceSheets { + /** + * Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable downloadAsync(String billingAccountName, String billingProfileName, String invoiceName); + + /** + * Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 for the request + */ + Observable downloadByBillingProfileAsync(String billingAccountName, String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Product.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Product.java new file mode 100644 index 0000000000000..4e509fee71bba --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Product.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.ProductInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; + +/** + * Type representing Product. + */ +public interface Product extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the availabilityId value. + */ + String availabilityId(); + + /** + * @return the billingFrequency value. + */ + BillingFrequency billingFrequency(); + + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * @return the customerId value. + */ + String customerId(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the endDate value. + */ + DateTime endDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the lastCharge value. + */ + Amount lastCharge(); + + /** + * @return the lastChargeDate value. + */ + DateTime lastChargeDate(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parentProductId value. + */ + String parentProductId(); + + /** + * @return the productType value. + */ + String productType(); + + /** + * @return the productTypeId value. + */ + String productTypeId(); + + /** + * @return the purchaseDate value. + */ + DateTime purchaseDate(); + + /** + * @return the quantity value. + */ + Double quantity(); + + /** + * @return the reseller value. + */ + Reseller reseller(); + + /** + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * @return the skuId value. + */ + String skuId(); + + /** + * @return the status value. + */ + ProductStatusType status(); + + /** + * @return the tenantId value. + */ + String tenantId(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductDetails.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductDetails.java new file mode 100644 index 0000000000000..a0c4195391a3c --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductDetails.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of the product that is transferred. + */ +public class ProductDetails { + /** + * Type of the product that is transferred. Possible values include: + * 'AzureSubscription', 'AzureReservation'. + */ + @JsonProperty(value = "productType") + private ProductType productType; + + /** + * The ID of the product that is transferred. + */ + @JsonProperty(value = "productId") + private String productId; + + /** + * Get type of the product that is transferred. Possible values include: 'AzureSubscription', 'AzureReservation'. + * + * @return the productType value + */ + public ProductType productType() { + return this.productType; + } + + /** + * Set type of the product that is transferred. Possible values include: 'AzureSubscription', 'AzureReservation'. + * + * @param productType the productType value to set + * @return the ProductDetails object itself. + */ + public ProductDetails withProductType(ProductType productType) { + this.productType = productType; + return this; + } + + /** + * Get the ID of the product that is transferred. + * + * @return the productId value + */ + public String productId() { + return this.productId; + } + + /** + * Set the ID of the product that is transferred. + * + * @param productId the productId value to set + * @return the ProductDetails object itself. + */ + public ProductDetails withProductId(String productId) { + this.productId = productId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductStatusType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductStatusType.java new file mode 100644 index 0000000000000..54885b626b533 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductStatusType.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProductStatusType. + */ +public final class ProductStatusType extends ExpandableStringEnum { + /** Static value Active for ProductStatusType. */ + public static final ProductStatusType ACTIVE = fromString("Active"); + + /** Static value Inactive for ProductStatusType. */ + public static final ProductStatusType INACTIVE = fromString("Inactive"); + + /** Static value PastDue for ProductStatusType. */ + public static final ProductStatusType PAST_DUE = fromString("PastDue"); + + /** Static value Expiring for ProductStatusType. */ + public static final ProductStatusType EXPIRING = fromString("Expiring"); + + /** Static value Expired for ProductStatusType. */ + public static final ProductStatusType EXPIRED = fromString("Expired"); + + /** Static value Disabled for ProductStatusType. */ + public static final ProductStatusType DISABLED = fromString("Disabled"); + + /** Static value Cancelled for ProductStatusType. */ + public static final ProductStatusType CANCELLED = fromString("Cancelled"); + + /** Static value AutoRenew for ProductStatusType. */ + public static final ProductStatusType AUTO_RENEW = fromString("AutoRenew"); + + /** + * Creates or finds a ProductStatusType from its string representation. + * @param name a name to look for + * @return the corresponding ProductStatusType + */ + @JsonCreator + public static ProductStatusType fromString(String name) { + return fromString(name, ProductStatusType.class); + } + + /** + * @return known ProductStatusType values + */ + public static Collection values() { + return values(ProductStatusType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductTransferStatus.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductTransferStatus.java new file mode 100644 index 0000000000000..f5c328e1c819e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductTransferStatus.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProductTransferStatus. + */ +public final class ProductTransferStatus extends ExpandableStringEnum { + /** Static value NotStarted for ProductTransferStatus. */ + public static final ProductTransferStatus NOT_STARTED = fromString("NotStarted"); + + /** Static value InProgress for ProductTransferStatus. */ + public static final ProductTransferStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Completed for ProductTransferStatus. */ + public static final ProductTransferStatus COMPLETED = fromString("Completed"); + + /** Static value Failed for ProductTransferStatus. */ + public static final ProductTransferStatus FAILED = fromString("Failed"); + + /** + * Creates or finds a ProductTransferStatus from its string representation. + * @param name a name to look for + * @return the corresponding ProductTransferStatus + */ + @JsonCreator + public static ProductTransferStatus fromString(String name) { + return fromString(name, ProductTransferStatus.class); + } + + /** + * @return known ProductTransferStatus values + */ + public static Collection values() { + return values(ProductTransferStatus.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductTransferValidationErrorCode.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductTransferValidationErrorCode.java new file mode 100644 index 0000000000000..2f1536a3827c4 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductTransferValidationErrorCode.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProductTransferValidationErrorCode. + */ +public final class ProductTransferValidationErrorCode extends ExpandableStringEnum { + /** Static value InvalidSource for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode INVALID_SOURCE = fromString("InvalidSource"); + + /** Static value ProductNotActive for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode PRODUCT_NOT_ACTIVE = fromString("ProductNotActive"); + + /** Static value InsufficientPermissionOnSource for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode INSUFFICIENT_PERMISSION_ON_SOURCE = fromString("InsufficientPermissionOnSource"); + + /** Static value InsufficientPermissionOnDestination for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode INSUFFICIENT_PERMISSION_ON_DESTINATION = fromString("InsufficientPermissionOnDestination"); + + /** Static value DestinationBillingProfilePastDue for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode DESTINATION_BILLING_PROFILE_PAST_DUE = fromString("DestinationBillingProfilePastDue"); + + /** Static value ProductTypeNotSupported for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode PRODUCT_TYPE_NOT_SUPPORTED = fromString("ProductTypeNotSupported"); + + /** Static value CrossBillingAccountNotAllowed for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode CROSS_BILLING_ACCOUNT_NOT_ALLOWED = fromString("CrossBillingAccountNotAllowed"); + + /** Static value NotAvailableForDestinationMarket for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode NOT_AVAILABLE_FOR_DESTINATION_MARKET = fromString("NotAvailableForDestinationMarket"); + + /** Static value OneTimePurchaseProductTransferNotAllowed for ProductTransferValidationErrorCode. */ + public static final ProductTransferValidationErrorCode ONE_TIME_PURCHASE_PRODUCT_TRANSFER_NOT_ALLOWED = fromString("OneTimePurchaseProductTransferNotAllowed"); + + /** + * Creates or finds a ProductTransferValidationErrorCode from its string representation. + * @param name a name to look for + * @return the corresponding ProductTransferValidationErrorCode + */ + @JsonCreator + public static ProductTransferValidationErrorCode fromString(String name) { + return fromString(name, ProductTransferValidationErrorCode.class); + } + + /** + * @return known ProductTransferValidationErrorCode values + */ + public static Collection values() { + return values(ProductTransferValidationErrorCode.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductType.java new file mode 100644 index 0000000000000..c9e316045234c --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ProductType. + */ +public final class ProductType extends ExpandableStringEnum { + /** Static value AzureSubscription for ProductType. */ + public static final ProductType AZURE_SUBSCRIPTION = fromString("AzureSubscription"); + + /** Static value AzureReservation for ProductType. */ + public static final ProductType AZURE_RESERVATION = fromString("AzureReservation"); + + /** + * Creates or finds a ProductType from its string representation. + * @param name a name to look for + * @return the corresponding ProductType + */ + @JsonCreator + public static ProductType fromString(String name) { + return fromString(name, ProductType.class); + } + + /** + * @return known ProductType values + */ + public static Collection values() { + return values(ProductType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Products.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Products.java new file mode 100644 index 0000000000000..f3f1367cdcae9 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Products.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.ProductsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Products. + */ +public interface Products extends HasInner { + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomerAsync(String billingAccountName, String customerName); + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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); + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only 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 for the request + */ + Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Gets a product by ID. The operation is supported only 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 productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName); + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the transfer product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable transferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters); + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate transfer eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateTransferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters); + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @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 productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAutoRenewByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName); + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByCustomerAsync(String billingAccountName, String customerName, String productName); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductsListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductsListResult.java new file mode 100644 index 0000000000000..797b36f06b59c --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductsListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.ProductsListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.ProductInner; +import java.util.List; + +/** + * Type representing ProductsListResult. + */ +public interface ProductsListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value 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/ProductsTransferHeaders.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductsTransferHeaders.java new file mode 100644 index 0000000000000..e329ea4ab8c59 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ProductsTransferHeaders.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Transfer operation. + */ +public class ProductsTransferHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommended time to wait before making another request to check the + * status of the operation. The time is specified in seconds. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the ProductsTransferHeaders object itself. + */ + public ProductsTransferHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommended time to wait before making another request to check the status of the operation. The time is specified in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the ProductsTransferHeaders object itself. + */ + public ProductsTransferHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RebillDocumentType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RebillDocumentType.java new file mode 100644 index 0000000000000..e54fb1a53bedc --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RebillDocumentType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for RebillDocumentType. + */ +public final class RebillDocumentType extends ExpandableStringEnum { + /** Static value Credit for RebillDocumentType. */ + public static final RebillDocumentType CREDIT = fromString("Credit"); + + /** Static value Rebill for RebillDocumentType. */ + public static final RebillDocumentType REBILL = fromString("Rebill"); + + /** Static value Original for RebillDocumentType. */ + public static final RebillDocumentType ORIGINAL = fromString("Original"); + + /** + * Creates or finds a RebillDocumentType from its string representation. + * @param name a name to look for + * @return the corresponding RebillDocumentType + */ + @JsonCreator + public static RebillDocumentType fromString(String name) { + return fromString(name, RebillDocumentType.class); + } + + /** + * @return known RebillDocumentType values + */ + public static Collection values() { + return values(RebillDocumentType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransferDetails.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransferDetails.java new file mode 100644 index 0000000000000..d79fe28a86df7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransferDetails.java @@ -0,0 +1,82 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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.RecipientTransferDetailsInner; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing RecipientTransferDetails. + */ +public interface RecipientTransferDetails extends HasInner, HasManager { + /** + * @return the allowedProductType value. + */ + List allowedProductType(); + + /** + * @return the canceledBy value. + */ + String canceledBy(); + + /** + * @return the creationTime value. + */ + DateTime creationTime(); + + /** + * @return the detailedTransferStatus value. + */ + List detailedTransferStatus(); + + /** + * @return the expirationTime value. + */ + DateTime expirationTime(); + + /** + * @return the initiatorCustomerType value. + */ + String initiatorCustomerType(); + + /** + * @return the initiatorEmailId value. + */ + String initiatorEmailId(); + + /** + * @return the lastModifiedTime value. + */ + DateTime lastModifiedTime(); + + /** + * @return the recipientEmailId value. + */ + String recipientEmailId(); + + /** + * @return the resellerId value. + */ + String resellerId(); + + /** + * @return the resellerName value. + */ + String resellerName(); + + /** + * @return the transferStatus value. + */ + TransferStatus transferStatus(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransfers.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransfers.java new file mode 100644 index 0000000000000..028e976c95185 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/RecipientTransfers.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.RecipientTransfersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RecipientTransfers. + */ +public interface RecipientTransfers extends HasInner { + /** + * Accepts a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable acceptAsync(String transferName); + + /** + * Validates if a subscription or a reservation can be transferred. Use this operation to validate your subscriptions or reservation before using the accept transfer operation. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateAsync(String transferName); + + /** + * Declines a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable declineAsync(String transferName); + + /** + * Gets a transfer request by ID. The caller must be the recipient of the transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String transferName); + + /** + * Lists the transfer requests received by the caller. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Reseller.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Reseller.java new file mode 100644 index 0000000000000..1af71dbc00e54 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Reseller.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of the reseller. + */ +public class Reseller { + /** + * The MPN ID of the reseller. + */ + @JsonProperty(value = "resellerId", access = JsonProperty.Access.WRITE_ONLY) + private String resellerId; + + /** + * The name of the reseller. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the MPN ID of the reseller. + * + * @return the resellerId value + */ + public String resellerId() { + return this.resellerId; + } + + /** + * Get the name of the reseller. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ReservationPurchasesPolicy.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ReservationPurchasesPolicy.java new file mode 100644 index 0000000000000..4aee74b5e8979 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ReservationPurchasesPolicy.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReservationPurchasesPolicy. + */ +public final class ReservationPurchasesPolicy extends ExpandableStringEnum { + /** Static value Allowed for ReservationPurchasesPolicy. */ + public static final ReservationPurchasesPolicy ALLOWED = fromString("Allowed"); + + /** Static value NotAllowed for ReservationPurchasesPolicy. */ + public static final ReservationPurchasesPolicy NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a ReservationPurchasesPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ReservationPurchasesPolicy + */ + @JsonCreator + public static ReservationPurchasesPolicy fromString(String name) { + return fromString(name, ReservationPurchasesPolicy.class); + } + + /** + * @return known ReservationPurchasesPolicy values + */ + public static Collection values() { + return values(ReservationPurchasesPolicy.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ReservationType.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ReservationType.java new file mode 100644 index 0000000000000..d11573e9b5214 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ReservationType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReservationType. + */ +public final class ReservationType extends ExpandableStringEnum { + /** Static value Purchase for ReservationType. */ + public static final ReservationType PURCHASE = fromString("Purchase"); + + /** Static value Usage Charge for ReservationType. */ + public static final ReservationType USAGE_CHARGE = fromString("Usage Charge"); + + /** + * Creates or finds a ReservationType from its string representation. + * @param name a name to look for + * @return the corresponding ReservationType + */ + @JsonCreator + public static ReservationType fromString(String name) { + return fromString(name, ReservationType.class); + } + + /** + * @return known ReservationType values + */ + public static Collection values() { + return values(ReservationType.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/SpendingLimit.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/SpendingLimit.java new file mode 100644 index 0000000000000..f70b1f1296443 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/SpendingLimit.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SpendingLimit. + */ +public final class SpendingLimit extends ExpandableStringEnum { + /** Static value Off for SpendingLimit. */ + public static final SpendingLimit OFF = fromString("Off"); + + /** Static value On for SpendingLimit. */ + public static final SpendingLimit ON = fromString("On"); + + /** + * Creates or finds a SpendingLimit from its string representation. + * @param name a name to look for + * @return the corresponding SpendingLimit + */ + @JsonCreator + public static SpendingLimit fromString(String name) { + return fromString(name, SpendingLimit.class); + } + + /** + * @return known SpendingLimit values + */ + public static Collection values() { + return values(SpendingLimit.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/StatusReasonCode.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/StatusReasonCode.java new file mode 100644 index 0000000000000..9865b46201ed6 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/StatusReasonCode.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for StatusReasonCode. + */ +public final class StatusReasonCode extends ExpandableStringEnum { + /** Static value PastDue for StatusReasonCode. */ + public static final StatusReasonCode PAST_DUE = fromString("PastDue"); + + /** Static value SpendingLimitReached for StatusReasonCode. */ + public static final StatusReasonCode SPENDING_LIMIT_REACHED = fromString("SpendingLimitReached"); + + /** Static value SpendingLimitExpired for StatusReasonCode. */ + public static final StatusReasonCode SPENDING_LIMIT_EXPIRED = fromString("SpendingLimitExpired"); + + /** + * Creates or finds a StatusReasonCode from its string representation. + * @param name a name to look for + * @return the corresponding StatusReasonCode + */ + @JsonCreator + public static StatusReasonCode fromString(String name) { + return fromString(name, StatusReasonCode.class); + } + + /** + * @return known StatusReasonCode values + */ + public static Collection values() { + return values(StatusReasonCode.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/SubscriptionTransferValidationErrorCode.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/SubscriptionTransferValidationErrorCode.java new file mode 100644 index 0000000000000..ce9312cd4a7df --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/SubscriptionTransferValidationErrorCode.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SubscriptionTransferValidationErrorCode. + */ +public final class SubscriptionTransferValidationErrorCode extends ExpandableStringEnum { + /** Static value InvalidSource for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode INVALID_SOURCE = fromString("InvalidSource"); + + /** Static value SubscriptionNotActive for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode SUBSCRIPTION_NOT_ACTIVE = fromString("SubscriptionNotActive"); + + /** Static value InsufficientPermissionOnSource for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode INSUFFICIENT_PERMISSION_ON_SOURCE = fromString("InsufficientPermissionOnSource"); + + /** Static value InsufficientPermissionOnDestination for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode INSUFFICIENT_PERMISSION_ON_DESTINATION = fromString("InsufficientPermissionOnDestination"); + + /** Static value DestinationBillingProfilePastDue for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode DESTINATION_BILLING_PROFILE_PAST_DUE = fromString("DestinationBillingProfilePastDue"); + + /** Static value SubscriptionTypeNotSupported for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode SUBSCRIPTION_TYPE_NOT_SUPPORTED = fromString("SubscriptionTypeNotSupported"); + + /** Static value CrossBillingAccountNotAllowed for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode CROSS_BILLING_ACCOUNT_NOT_ALLOWED = fromString("CrossBillingAccountNotAllowed"); + + /** Static value NotAvailableForDestinationMarket for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode NOT_AVAILABLE_FOR_DESTINATION_MARKET = fromString("NotAvailableForDestinationMarket"); + + /** + * Creates or finds a SubscriptionTransferValidationErrorCode from its string representation. + * @param name a name to look for + * @return the corresponding SubscriptionTransferValidationErrorCode + */ + @JsonCreator + public static SubscriptionTransferValidationErrorCode fromString(String name) { + return fromString(name, SubscriptionTransferValidationErrorCode.class); + } + + /** + * @return known SubscriptionTransferValidationErrorCode values + */ + public static Collection values() { + return values(SubscriptionTransferValidationErrorCode.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transaction.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transaction.java new file mode 100644 index 0000000000000..fdb12e898ed29 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transaction.java @@ -0,0 +1,206 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.TransactionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; + +/** + * Type representing Transaction. + */ +public interface Transaction extends HasInner, HasManager { + /** + * @return the azureCreditApplied value. + */ + Amount azureCreditApplied(); + + /** + * @return the billingCurrency value. + */ + String billingCurrency(); + + /** + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * @return the customerId value. + */ + String customerId(); + + /** + * @return the dateProperty value. + */ + DateTime dateProperty(); + + /** + * @return the discount value. + */ + Double discount(); + + /** + * @return the effectivePrice value. + */ + Amount effectivePrice(); + + /** + * @return the exchangeRate value. + */ + Double exchangeRate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoice value. + */ + String invoice(); + + /** + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the kind value. + */ + TransactionTypeKind kind(); + + /** + * @return the marketPrice value. + */ + Amount marketPrice(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the orderId value. + */ + String orderId(); + + /** + * @return the orderName value. + */ + String orderName(); + + /** + * @return the pricingCurrency value. + */ + String pricingCurrency(); + + /** + * @return the productDescription value. + */ + String productDescription(); + + /** + * @return the productFamily value. + */ + String productFamily(); + + /** + * @return the productType value. + */ + String productType(); + + /** + * @return the productTypeId value. + */ + String productTypeId(); + + /** + * @return the quantity value. + */ + Integer quantity(); + + /** + * @return the servicePeriodEndDate value. + */ + DateTime servicePeriodEndDate(); + + /** + * @return the servicePeriodStartDate value. + */ + DateTime servicePeriodStartDate(); + + /** + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the subscriptionName value. + */ + String subscriptionName(); + + /** + * @return the subTotal value. + */ + Amount subTotal(); + + /** + * @return the tax value. + */ + Amount tax(); + + /** + * @return the transactionAmount value. + */ + Amount transactionAmount(); + + /** + * @return the transactionType value. + */ + ReservationType transactionType(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the unitOfMeasure value. + */ + String unitOfMeasure(); + + /** + * @return the units value. + */ + Double units(); + + /** + * @return the unitType value. + */ + String unitType(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransactionListResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransactionListResult.java new file mode 100644 index 0000000000000..2b5233584e281 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransactionListResult.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.TransactionListResultInner; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.TransactionInner; +import java.util.List; + +/** + * Type representing TransactionListResult. + */ +public interface TransactionListResult extends HasInner, HasManager { + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the value 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/TransactionTypeKind.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransactionTypeKind.java new file mode 100644 index 0000000000000..d5fd2688e45cf --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransactionTypeKind.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TransactionTypeKind. + */ +public final class TransactionTypeKind extends ExpandableStringEnum { + /** Static value all for TransactionTypeKind. */ + public static final TransactionTypeKind ALL = fromString("all"); + + /** Static value reservation for TransactionTypeKind. */ + public static final TransactionTypeKind RESERVATION = fromString("reservation"); + + /** + * Creates or finds a TransactionTypeKind from its string representation. + * @param name a name to look for + * @return the corresponding TransactionTypeKind + */ + @JsonCreator + public static TransactionTypeKind fromString(String name) { + return fromString(name, TransactionTypeKind.class); + } + + /** + * @return known TransactionTypeKind values + */ + public static Collection values() { + return values(TransactionTypeKind.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transactions.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transactions.java new file mode 100644 index 0000000000000..8264b263e42f7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transactions.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.TransactionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Transactions. + */ +public interface Transactions extends HasInner { + /** + * Lists the billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate); + + /** + * Lists the billed and unbilled transactions by billing profile name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate); + + /** + * Lists the billed and unbilled transactions by invoice section name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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 periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String periodStartDate, String periodEndDate); + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceAsync(final String billingAccountName, final String billingProfileName, final String invoiceName); + + /** + * Gets a transaction by ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param transactionName The ID that uniquely identifies a transaction. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName, String transactionName, String periodStartDate, String periodEndDate); + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomerAsync(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionRequest.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionRequest.java new file mode 100644 index 0000000000000..17dcc5b50cd1c --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionRequest.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Request parameters to transfer billing subscription. + */ +@JsonFlatten +public class TransferBillingSubscriptionRequest { + /** + * The destination invoice section id. + */ + @JsonProperty(value = "properties.destinationInvoiceSectionId") + private String destinationInvoiceSectionId; + + /** + * The destination billing profile id. + */ + @JsonProperty(value = "properties.destinationBillingProfileId") + private String destinationBillingProfileId; + + /** + * Get the destination invoice section id. + * + * @return the destinationInvoiceSectionId value + */ + public String destinationInvoiceSectionId() { + return this.destinationInvoiceSectionId; + } + + /** + * Set the destination invoice section id. + * + * @param destinationInvoiceSectionId the destinationInvoiceSectionId value to set + * @return the TransferBillingSubscriptionRequest object itself. + */ + public TransferBillingSubscriptionRequest withDestinationInvoiceSectionId(String destinationInvoiceSectionId) { + this.destinationInvoiceSectionId = destinationInvoiceSectionId; + return this; + } + + /** + * Get the destination billing profile id. + * + * @return the destinationBillingProfileId value + */ + public String destinationBillingProfileId() { + return this.destinationBillingProfileId; + } + + /** + * Set the destination billing profile id. + * + * @param destinationBillingProfileId the destinationBillingProfileId value to set + * @return the TransferBillingSubscriptionRequest object itself. + */ + public TransferBillingSubscriptionRequest withDestinationBillingProfileId(String destinationBillingProfileId) { + this.destinationBillingProfileId = destinationBillingProfileId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionRequestProperties.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionRequestProperties.java new file mode 100644 index 0000000000000..3f7b1c31262cd --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionRequestProperties.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters to transfer billing subscription. + */ +public class TransferBillingSubscriptionRequestProperties { + /** + * The destination invoice section id. + */ + @JsonProperty(value = "destinationInvoiceSectionId") + private String destinationInvoiceSectionId; + + /** + * The destination billing profile id. + */ + @JsonProperty(value = "destinationBillingProfileId") + private String destinationBillingProfileId; + + /** + * Get the destination invoice section id. + * + * @return the destinationInvoiceSectionId value + */ + public String destinationInvoiceSectionId() { + return this.destinationInvoiceSectionId; + } + + /** + * Set the destination invoice section id. + * + * @param destinationInvoiceSectionId the destinationInvoiceSectionId value to set + * @return the TransferBillingSubscriptionRequestProperties object itself. + */ + public TransferBillingSubscriptionRequestProperties withDestinationInvoiceSectionId(String destinationInvoiceSectionId) { + this.destinationInvoiceSectionId = destinationInvoiceSectionId; + return this; + } + + /** + * Get the destination billing profile id. + * + * @return the destinationBillingProfileId value + */ + public String destinationBillingProfileId() { + return this.destinationBillingProfileId; + } + + /** + * Set the destination billing profile id. + * + * @param destinationBillingProfileId the destinationBillingProfileId value to set + * @return the TransferBillingSubscriptionRequestProperties object itself. + */ + public TransferBillingSubscriptionRequestProperties withDestinationBillingProfileId(String destinationBillingProfileId) { + this.destinationBillingProfileId = destinationBillingProfileId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionResult.java new file mode 100644 index 0000000000000..ef94a0abf85ac --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferBillingSubscriptionResult.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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.TransferBillingSubscriptionResultInner; + +/** + * Type representing TransferBillingSubscriptionResult. + */ +public interface TransferBillingSubscriptionResult extends HasInner, HasManager { + /** + * @return the billingSubscriptionName value. + */ + String billingSubscriptionName(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferProductRequestProperties.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferProductRequestProperties.java new file mode 100644 index 0000000000000..9441fb3726997 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferProductRequestProperties.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the product to initiate a transfer. + */ +public class TransferProductRequestProperties { + /** + * The destination invoice section id. + */ + @JsonProperty(value = "destinationInvoiceSectionId") + private String destinationInvoiceSectionId; + + /** + * The destination billing profile id. + */ + @JsonProperty(value = "destinationBillingProfileId") + private String destinationBillingProfileId; + + /** + * Get the destination invoice section id. + * + * @return the destinationInvoiceSectionId value + */ + public String destinationInvoiceSectionId() { + return this.destinationInvoiceSectionId; + } + + /** + * Set the destination invoice section id. + * + * @param destinationInvoiceSectionId the destinationInvoiceSectionId value to set + * @return the TransferProductRequestProperties object itself. + */ + public TransferProductRequestProperties withDestinationInvoiceSectionId(String destinationInvoiceSectionId) { + this.destinationInvoiceSectionId = destinationInvoiceSectionId; + return this; + } + + /** + * Get the destination billing profile id. + * + * @return the destinationBillingProfileId value + */ + public String destinationBillingProfileId() { + return this.destinationBillingProfileId; + } + + /** + * Set the destination billing profile id. + * + * @param destinationBillingProfileId the destinationBillingProfileId value to set + * @return the TransferProductRequestProperties object itself. + */ + public TransferProductRequestProperties withDestinationBillingProfileId(String destinationBillingProfileId) { + this.destinationBillingProfileId = destinationBillingProfileId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferStatus.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferStatus.java new file mode 100644 index 0000000000000..8aa715d1f6f19 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/TransferStatus.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TransferStatus. + */ +public final class TransferStatus extends ExpandableStringEnum { + /** Static value Pending for TransferStatus. */ + public static final TransferStatus PENDING = fromString("Pending"); + + /** Static value InProgress for TransferStatus. */ + public static final TransferStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Completed for TransferStatus. */ + public static final TransferStatus COMPLETED = fromString("Completed"); + + /** Static value CompletedWithErrors for TransferStatus. */ + public static final TransferStatus COMPLETED_WITH_ERRORS = fromString("CompletedWithErrors"); + + /** Static value Failed for TransferStatus. */ + public static final TransferStatus FAILED = fromString("Failed"); + + /** Static value Canceled for TransferStatus. */ + public static final TransferStatus CANCELED = fromString("Canceled"); + + /** Static value Declined for TransferStatus. */ + public static final TransferStatus DECLINED = fromString("Declined"); + + /** + * Creates or finds a TransferStatus from its string representation. + * @param name a name to look for + * @return the corresponding TransferStatus + */ + @JsonCreator + public static TransferStatus fromString(String name) { + return fromString(name, TransferStatus.class); + } + + /** + * @return known TransferStatus values + */ + public static Collection values() { + return values(TransferStatus.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transfers.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transfers.java new file mode 100644 index 0000000000000..33b27b983368a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/Transfers.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.implementation.TransfersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Transfers. + */ +public interface Transfers extends HasInner { + /** + * Gets a transfer request by ID. The operation is supported only 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 transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName); + + /** + * Lists the transfer requests for an invoice section. The operation is supported only 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 for the request + */ + Observable listAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName); + + /** + * Cancels a transfer request. The operation is supported only 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 transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName); + + /** + * Sends a request to a user in another billing account to transfer billing ownership of their subscriptions. The operation is supported only 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 initiate transfer operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable initiateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, InitiateTransferRequest parameters); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenew.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenew.java new file mode 100644 index 0000000000000..9eaabbce32fa7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenew.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UpdateAutoRenew. + */ +public final class UpdateAutoRenew extends ExpandableStringEnum { + /** Static value true for UpdateAutoRenew. */ + public static final UpdateAutoRenew TRUE = fromString("true"); + + /** Static value false for UpdateAutoRenew. */ + public static final UpdateAutoRenew FALSE = fromString("false"); + + /** + * Creates or finds a UpdateAutoRenew from its string representation. + * @param name a name to look for + * @return the corresponding UpdateAutoRenew + */ + @JsonCreator + public static UpdateAutoRenew fromString(String name) { + return fromString(name, UpdateAutoRenew.class); + } + + /** + * @return known UpdateAutoRenew values + */ + public static Collection values() { + return values(UpdateAutoRenew.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenewOperation.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenewOperation.java new file mode 100644 index 0000000000000..6c0d46a415231 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenewOperation.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.UpdateAutoRenewOperationInner; +import org.joda.time.DateTime; + +/** + * Type representing UpdateAutoRenewOperation. + */ +public interface UpdateAutoRenewOperation extends HasInner, HasManager { + /** + * @return the endDate value. + */ + DateTime endDate(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenewRequest.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenewRequest.java new file mode 100644 index 0000000000000..41aa427c90a9e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/UpdateAutoRenewRequest.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters to update auto renew settings for a product. + */ +public class UpdateAutoRenewRequest { + /** + * The flag that determines the auto-renew settings for a product. Possible + * values include: 'true', 'false'. + */ + @JsonProperty(value = "autoRenew") + private UpdateAutoRenew autoRenew; + + /** + * Get the flag that determines the auto-renew settings for a product. Possible values include: 'true', 'false'. + * + * @return the autoRenew value + */ + public UpdateAutoRenew autoRenew() { + return this.autoRenew; + } + + /** + * Set the flag that determines the auto-renew settings for a product. Possible values include: 'true', 'false'. + * + * @param autoRenew the autoRenew value to set + * @return the UpdateAutoRenewRequest object itself. + */ + public UpdateAutoRenewRequest withAutoRenew(UpdateAutoRenew autoRenew) { + this.autoRenew = autoRenew; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateAddressResponse.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateAddressResponse.java new file mode 100644 index 0000000000000..715bc11326956 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateAddressResponse.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.ValidateAddressResponseInner; +import java.util.List; + +/** + * Type representing ValidateAddressResponse. + */ +public interface ValidateAddressResponse extends HasInner, HasManager { + /** + * @return the status value. + */ + AddressValidationStatus status(); + + /** + * @return the suggestedAddresses value. + */ + List suggestedAddresses(); + + /** + * @return the validationMessage value. + */ + String validationMessage(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateProductTransferEligibilityError.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateProductTransferEligibilityError.java new file mode 100644 index 0000000000000..52c9876abd988 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateProductTransferEligibilityError.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details of the product transfer eligibility validation. + */ +public class ValidateProductTransferEligibilityError { + /** + * Error code for the product transfer validation. Possible values include: + * 'InvalidSource', 'ProductNotActive', 'InsufficientPermissionOnSource', + * 'InsufficientPermissionOnDestination', + * 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', + * 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', + * 'OneTimePurchaseProductTransferNotAllowed'. + */ + @JsonProperty(value = "code") + private ProductTransferValidationErrorCode code; + + /** + * The error message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Detailed error message explaining the error. + */ + @JsonProperty(value = "details") + private String details; + + /** + * Get error code for the product transfer validation. Possible values include: 'InvalidSource', 'ProductNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', 'OneTimePurchaseProductTransferNotAllowed'. + * + * @return the code value + */ + public ProductTransferValidationErrorCode code() { + return this.code; + } + + /** + * Set error code for the product transfer validation. Possible values include: 'InvalidSource', 'ProductNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'ProductTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket', 'OneTimePurchaseProductTransferNotAllowed'. + * + * @param code the code value to set + * @return the ValidateProductTransferEligibilityError object itself. + */ + public ValidateProductTransferEligibilityError withCode(ProductTransferValidationErrorCode code) { + this.code = code; + return this; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the error message. + * + * @param message the message value to set + * @return the ValidateProductTransferEligibilityError object itself. + */ + public ValidateProductTransferEligibilityError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get detailed error message explaining the error. + * + * @return the details value + */ + public String details() { + return this.details; + } + + /** + * Set detailed error message explaining the error. + * + * @param details the details value to set + * @return the ValidateProductTransferEligibilityError object itself. + */ + public ValidateProductTransferEligibilityError withDetails(String details) { + this.details = details; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateProductTransferEligibilityResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateProductTransferEligibilityResult.java new file mode 100644 index 0000000000000..f800507536337 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateProductTransferEligibilityResult.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.ValidateProductTransferEligibilityResultInner; + +/** + * Type representing ValidateProductTransferEligibilityResult. + */ +public interface ValidateProductTransferEligibilityResult extends HasInner, HasManager { + /** + * @return the errorDetails value. + */ + ValidateProductTransferEligibilityError errorDetails(); + + /** + * @return the isTransferEligible value. + */ + Boolean isTransferEligible(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateSubscriptionTransferEligibilityError.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateSubscriptionTransferEligibilityError.java new file mode 100644 index 0000000000000..d4afa107720bd --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateSubscriptionTransferEligibilityError.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details of the transfer eligibility validation. + */ +public class ValidateSubscriptionTransferEligibilityError { + /** + * Error code for the product transfer validation. Possible values include: + * 'InvalidSource', 'SubscriptionNotActive', + * 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', + * 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', + * 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket'. + */ + @JsonProperty(value = "code") + private SubscriptionTransferValidationErrorCode code; + + /** + * The error message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Detailed error message explaining the error. + */ + @JsonProperty(value = "details") + private String details; + + /** + * Get error code for the product transfer validation. Possible values include: 'InvalidSource', 'SubscriptionNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket'. + * + * @return the code value + */ + public SubscriptionTransferValidationErrorCode code() { + return this.code; + } + + /** + * Set error code for the product transfer validation. Possible values include: 'InvalidSource', 'SubscriptionNotActive', 'InsufficientPermissionOnSource', 'InsufficientPermissionOnDestination', 'DestinationBillingProfilePastDue', 'SubscriptionTypeNotSupported', 'CrossBillingAccountNotAllowed', 'NotAvailableForDestinationMarket'. + * + * @param code the code value to set + * @return the ValidateSubscriptionTransferEligibilityError object itself. + */ + public ValidateSubscriptionTransferEligibilityError withCode(SubscriptionTransferValidationErrorCode code) { + this.code = code; + return this; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the error message. + * + * @param message the message value to set + * @return the ValidateSubscriptionTransferEligibilityError object itself. + */ + public ValidateSubscriptionTransferEligibilityError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get detailed error message explaining the error. + * + * @return the details value + */ + public String details() { + return this.details; + } + + /** + * Set detailed error message explaining the error. + * + * @param details the details value to set + * @return the ValidateSubscriptionTransferEligibilityError object itself. + */ + public ValidateSubscriptionTransferEligibilityError withDetails(String details) { + this.details = details; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateSubscriptionTransferEligibilityResult.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateSubscriptionTransferEligibilityResult.java new file mode 100644 index 0000000000000..2d49ce34e747b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateSubscriptionTransferEligibilityResult.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.ValidateSubscriptionTransferEligibilityResultInner; + +/** + * Type representing ValidateSubscriptionTransferEligibilityResult. + */ +public interface ValidateSubscriptionTransferEligibilityResult extends HasInner, HasManager { + /** + * @return the errorDetails value. + */ + ValidateSubscriptionTransferEligibilityError errorDetails(); + + /** + * @return the isTransferEligible value. + */ + Boolean isTransferEligible(); + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateTransferListResponse.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateTransferListResponse.java new file mode 100644 index 0000000000000..731fa761a89fa --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateTransferListResponse.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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.ValidateTransferListResponseInner; +import java.util.List; + +/** + * Type representing ValidateTransferListResponse. + */ +public interface ValidateTransferListResponse extends HasInner, HasManager { + /** + * @return the value 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/ValidateTransferResponse.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateTransferResponse.java new file mode 100644 index 0000000000000..583ce50a943e6 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidateTransferResponse.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Transfer validation response. + */ +@JsonFlatten +public class ValidateTransferResponse { + /** + * The status of validation. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The product id for which this result applies. + */ + @JsonProperty(value = "properties.productId", access = JsonProperty.Access.WRITE_ONLY) + private String productId; + + /** + * The array of validation results. + */ + @JsonProperty(value = "properties.results") + private List results; + + /** + * Get the status of validation. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the product id for which this result applies. + * + * @return the productId value + */ + public String productId() { + return this.productId; + } + + /** + * Get the array of validation results. + * + * @return the results value + */ + public List results() { + return this.results; + } + + /** + * Set the array of validation results. + * + * @param results the results value to set + * @return the ValidateTransferResponse object itself. + */ + public ValidateTransferResponse withResults(List results) { + this.results = results; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidationResultProperties.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidationResultProperties.java new file mode 100644 index 0000000000000..9f4a5afbe522d --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ValidationResultProperties.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the validation result. + */ +public class ValidationResultProperties { + /** + * Result Level. + */ + @JsonProperty(value = "level", access = JsonProperty.Access.WRITE_ONLY) + private String level; + + /** + * Result Code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The validation message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get result Level. + * + * @return the level value + */ + public String level() { + return this.level; + } + + /** + * Get result Code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the validation message. + * + * @return the message value + */ + public String message() { + return this.message; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ViewCharges.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ViewCharges.java new file mode 100644 index 0000000000000..ee547dde4c949 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ViewCharges.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ViewCharges. + */ +public final class ViewCharges extends ExpandableStringEnum { + /** Static value Allowed for ViewCharges. */ + public static final ViewCharges ALLOWED = fromString("Allowed"); + + /** Static value NotAllowed for ViewCharges. */ + public static final ViewCharges NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a ViewCharges from its string representation. + * @param name a name to look for + * @return the corresponding ViewCharges + */ + @JsonCreator + public static ViewCharges fromString(String name) { + return fromString(name, ViewCharges.class); + } + + /** + * @return known ViewCharges values + */ + public static Collection values() { + return values(ViewCharges.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ViewChargesPolicy.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ViewChargesPolicy.java new file mode 100644 index 0000000000000..f2b91df11b948 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/ViewChargesPolicy.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ViewChargesPolicy. + */ +public final class ViewChargesPolicy extends ExpandableStringEnum { + /** Static value Allowed for ViewChargesPolicy. */ + public static final ViewChargesPolicy ALLOWED = fromString("Allowed"); + + /** Static value NotAllowed for ViewChargesPolicy. */ + public static final ViewChargesPolicy NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a ViewChargesPolicy from its string representation. + * @param name a name to look for + * @return the corresponding ViewChargesPolicy + */ + @JsonCreator + public static ViewChargesPolicy fromString(String name) { + return fromString(name, ViewChargesPolicy.class); + } + + /** + * @return known ViewChargesPolicy values + */ + public static Collection values() { + return values(ViewChargesPolicy.class); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AddressImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AddressImpl.java new file mode 100644 index 0000000000000..ca009c82a48b1 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AddressImpl.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Address; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ValidateAddressResponse; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AddressDetails; + +class AddressImpl extends WrapperImpl implements Address { + private final BillingManager manager; + + AddressImpl(BillingManager manager) { + super(manager.inner().address()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable validateAsync(AddressDetails address) { + AddressInner client = this.inner(); + return client.validateAsync(address) + .map(new Func1() { + @Override + public ValidateAddressResponse call(ValidateAddressResponseInner inner) { + return new ValidateAddressResponseImpl(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/AddressInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AddressInner.java new file mode 100644 index 0000000000000..1223e15dd15e8 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AddressInner.java @@ -0,0 +1,139 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AddressDetails; +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.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Address. + */ +public class AddressInner { + /** The Retrofit service to perform REST calls. */ + private AddressService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of AddressInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AddressInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(AddressService.class); + this.client = client; + } + + /** + * The interface defining all the services for Address to be + * used by Retrofit to perform actually REST calls. + */ + interface AddressService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Address validate" }) + @POST("providers/Microsoft.Billing/validateAddress") + Observable> validate(@Query("api-version") String apiVersion, @Body AddressDetails address, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Validates an address. Use the operation to validate an address before using it as a billing account or a billing profile address. + * + * @param address the AddressDetails value + * @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 ValidateAddressResponseInner object if successful. + */ + public ValidateAddressResponseInner validate(AddressDetails address) { + return validateWithServiceResponseAsync(address).toBlocking().single().body(); + } + + /** + * Validates an address. Use the operation to validate an address before using it as a billing account or a billing profile address. + * + * @param address the AddressDetails value + * @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 validateAsync(AddressDetails address, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateWithServiceResponseAsync(address), serviceCallback); + } + + /** + * Validates an address. Use the operation to validate an address before using it as a billing account or a billing profile address. + * + * @param address the AddressDetails value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateAddressResponseInner object + */ + public Observable validateAsync(AddressDetails address) { + return validateWithServiceResponseAsync(address).map(new Func1, ValidateAddressResponseInner>() { + @Override + public ValidateAddressResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates an address. Use the operation to validate an address before using it as a billing account or a billing profile address. + * + * @param address the AddressDetails value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateAddressResponseInner object + */ + public Observable> validateWithServiceResponseAsync(AddressDetails address) { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (address == null) { + throw new IllegalArgumentException("Parameter address is required and cannot be null."); + } + Validator.validate(address); + return service.validate(this.client.apiVersion(), address, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementImpl.java new file mode 100644 index 0000000000000..9dc0f530698dc --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementImpl.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.Agreement; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AcceptanceMode; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Category; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Participants; + +class AgreementImpl extends IndexableRefreshableWrapperImpl implements Agreement { + private final BillingManager manager; + private String billingAccountName; + private String agreementName; + + AgreementImpl(AgreementInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.agreementName = IdParsingUtils.getValueFromIdByName(inner.id(), "agreements"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + AgreementsInner client = this.manager().inner().agreements(); + return client.getAsync(this.billingAccountName, this.agreementName); + } + + + + @Override + public AcceptanceMode acceptanceMode() { + return this.inner().acceptanceMode(); + } + + @Override + public String agreementLink() { + return this.inner().agreementLink(); + } + + @Override + public Category category() { + return this.inner().category(); + } + + @Override + public DateTime effectiveDate() { + return this.inner().effectiveDate(); + } + + @Override + public DateTime expirationDate() { + return this.inner().expirationDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List participants() { + return this.inner().participants(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementInner.java new file mode 100644 index 0000000000000..98c2fb9f65d82 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementInner.java @@ -0,0 +1,145 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.Category; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AcceptanceMode; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Participants; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An agreement. + */ +@JsonFlatten +public class AgreementInner extends ProxyResource { + /** + * The URL to download the agreement. + */ + @JsonProperty(value = "properties.agreementLink", access = JsonProperty.Access.WRITE_ONLY) + private String agreementLink; + + /** + * The category of the agreement signed by a customer. Possible values + * include: 'MicrosoftCustomerAgreement', 'AffiliatePurchaseTerms', + * 'Other'. + */ + @JsonProperty(value = "properties.category", access = JsonProperty.Access.WRITE_ONLY) + private Category category; + + /** + * The mode of acceptance for an agreement. Possible values include: + * 'ClickToAccept', 'ESignEmbedded', 'ESignOffline'. + */ + @JsonProperty(value = "properties.acceptanceMode", access = JsonProperty.Access.WRITE_ONLY) + private AcceptanceMode acceptanceMode; + + /** + * The date from which the agreement is effective. + */ + @JsonProperty(value = "properties.effectiveDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime effectiveDate; + + /** + * The date when the agreement expires. + */ + @JsonProperty(value = "properties.expirationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expirationDate; + + /** + * The list of participants that participates in acceptance of an + * agreement. + */ + @JsonProperty(value = "properties.participants") + private List participants; + + /** + * The current status of the agreement. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Get the URL to download the agreement. + * + * @return the agreementLink value + */ + public String agreementLink() { + return this.agreementLink; + } + + /** + * Get the category of the agreement signed by a customer. Possible values include: 'MicrosoftCustomerAgreement', 'AffiliatePurchaseTerms', 'Other'. + * + * @return the category value + */ + public Category category() { + return this.category; + } + + /** + * Get the mode of acceptance for an agreement. Possible values include: 'ClickToAccept', 'ESignEmbedded', 'ESignOffline'. + * + * @return the acceptanceMode value + */ + public AcceptanceMode acceptanceMode() { + return this.acceptanceMode; + } + + /** + * Get the date from which the agreement is effective. + * + * @return the effectiveDate value + */ + public DateTime effectiveDate() { + return this.effectiveDate; + } + + /** + * Get the date when the agreement expires. + * + * @return the expirationDate value + */ + public DateTime expirationDate() { + return this.expirationDate; + } + + /** + * Get the list of participants that participates in acceptance of an agreement. + * + * @return the participants value + */ + public List participants() { + return this.participants; + } + + /** + * Set the list of participants that participates in acceptance of an agreement. + * + * @param participants the participants value to set + * @return the AgreementInner object itself. + */ + public AgreementInner withParticipants(List participants) { + this.participants = participants; + return this; + } + + /** + * Get the current status of the agreement. + * + * @return the status value + */ + public String status() { + return this.status; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementListResultImpl.java new file mode 100644 index 0000000000000..e01903c065f08 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementListResultImpl.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.AgreementListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class AgreementListResultImpl extends WrapperImpl implements AgreementListResult { + private final BillingManager manager; + AgreementListResultImpl(AgreementListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementListResultInner.java new file mode 100644 index 0000000000000..712e9a03a9663 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementListResultInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of listing agreements. + */ +public class AgreementListResultInner { + /** + * The list of agreements. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of agreements. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementsImpl.java new file mode 100644 index 0000000000000..ddb20727925cf --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementsImpl.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.Agreements; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AgreementListResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Agreement; + +class AgreementsImpl extends WrapperImpl implements Agreements { + private final BillingManager manager; + + AgreementsImpl(BillingManager manager) { + super(manager.inner().agreements()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private AgreementImpl wrapModel(AgreementInner inner) { + return new AgreementImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountAsync(String billingAccountName) { + AgreementsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .map(new Func1() { + @Override + public AgreementListResult call(AgreementListResultInner inner) { + return new AgreementListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String agreementName) { + AgreementsInner client = this.inner(); + return client.getAsync(billingAccountName, agreementName) + .flatMap(new Func1>() { + @Override + public Observable call(AgreementInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Agreement)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/AgreementsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementsInner.java new file mode 100644 index 0000000000000..42642912e7bb4 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AgreementsInner.java @@ -0,0 +1,378 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Agreements. + */ +public class AgreementsInner { + /** The Retrofit service to perform REST calls. */ + private AgreementsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of AgreementsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AgreementsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(AgreementsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Agreements to be + * used by Retrofit to perform actually REST calls. + */ + interface AgreementsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Agreements listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Agreements get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("agreementName") String agreementName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the agreements for a billing account. + * + * @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 AgreementListResultInner object if successful. + */ + public AgreementListResultInner listByBillingAccount(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists the agreements for a billing account. + * + * @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(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementListResultInner object + */ + public Observable listByBillingAccountAsync(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, AgreementListResultInner>() { + @Override + public AgreementListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementListResultInner object + */ + public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AgreementListResultInner object if successful. + */ + public AgreementListResultInner listByBillingAccount(String billingAccountName, String expand) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, expand).toBlocking().single().body(); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingAccountAsync(String billingAccountName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName, expand), serviceCallback); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementListResultInner object + */ + public Observable listByBillingAccountAsync(String billingAccountName, String expand) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, expand).map(new Func1, AgreementListResultInner>() { + @Override + public AgreementListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementListResultInner object + */ + public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @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 AgreementInner object if successful. + */ + public AgreementInner get(String billingAccountName, String agreementName) { + return getWithServiceResponseAsync(billingAccountName, agreementName).toBlocking().single().body(); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String agreementName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, agreementName), serviceCallback); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementInner object + */ + public Observable getAsync(String billingAccountName, String agreementName) { + return getWithServiceResponseAsync(billingAccountName, agreementName).map(new Func1, AgreementInner>() { + @Override + public AgreementInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String agreementName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (agreementName == null) { + throw new IllegalArgumentException("Parameter agreementName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.get(billingAccountName, agreementName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @param expand May be used to expand the participants. + * @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 AgreementInner object if successful. + */ + public AgreementInner get(String billingAccountName, String agreementName, String expand) { + return getWithServiceResponseAsync(billingAccountName, agreementName, expand).toBlocking().single().body(); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @param expand May be used to expand the participants. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String agreementName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, agreementName, expand), serviceCallback); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementInner object + */ + public Observable getAsync(String billingAccountName, String agreementName, String expand) { + return getWithServiceResponseAsync(billingAccountName, agreementName, expand).map(new Func1, AgreementInner>() { + @Override + public AgreementInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AgreementInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String agreementName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (agreementName == null) { + throw new IllegalArgumentException("Parameter agreementName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, agreementName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalanceImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalanceImpl.java new file mode 100644 index 0000000000000..a1ede847a470d --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalanceImpl.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.AvailableBalance; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Amount; + +class AvailableBalanceImpl extends WrapperImpl implements AvailableBalance { + private final BillingManager manager; + AvailableBalanceImpl(AvailableBalanceInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Amount amount() { + return this.inner().amount(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalanceInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalanceInner.java new file mode 100644 index 0000000000000..4328a2e93d903 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalanceInner.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.Amount; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The latest Azure credit balance. This is the balance available for pay now. + */ +@JsonFlatten +public class AvailableBalanceInner extends ProxyResource { + /** + * Balance amount. + */ + @JsonProperty(value = "properties.amount", access = JsonProperty.Access.WRITE_ONLY) + private Amount amount; + + /** + * Get balance amount. + * + * @return the amount value + */ + public Amount amount() { + return this.amount; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalancesImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalancesImpl.java new file mode 100644 index 0000000000000..adf6a77f678b8 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalancesImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AvailableBalances; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AvailableBalance; + +class AvailableBalancesImpl extends WrapperImpl implements AvailableBalances { + private final BillingManager manager; + + AvailableBalancesImpl(BillingManager manager) { + super(manager.inner().availableBalances()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName) { + AvailableBalancesInner client = this.inner(); + return client.getByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public AvailableBalance call(AvailableBalanceInner inner) { + return new AvailableBalanceImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalancesInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalancesInner.java new file mode 100644 index 0000000000000..e95f558cce00f --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/AvailableBalancesInner.java @@ -0,0 +1,143 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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 java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AvailableBalances. + */ +public class AvailableBalancesInner { + /** The Retrofit service to perform REST calls. */ + private AvailableBalancesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of AvailableBalancesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AvailableBalancesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(AvailableBalancesService.class); + this.client = client; + } + + /** + * The interface defining all the services for AvailableBalances to be + * used by Retrofit to perform actually REST calls. + */ + interface AvailableBalancesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.AvailableBalances getByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default") + Observable> getByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only 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 AvailableBalanceInner object if successful. + */ + public AvailableBalanceInner getByBillingProfile(String billingAccountName, String billingProfileName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only 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 getByBillingProfileAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only 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 AvailableBalanceInner object + */ + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, AvailableBalanceInner>() { + @Override + public AvailableBalanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle due or past due invoices. The operation is supported only 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 AvailableBalanceInner object + */ + public Observable> getByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountImpl.java new file mode 100644 index 0000000000000..208bb62230869 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountImpl.java @@ -0,0 +1,200 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingAccount; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccountUpdateRequest; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AccountType; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AddressDetails; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AgreementType; +import java.util.ArrayList; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfile; +import com.microsoft.azure.management.billing.v2019_10_01_preview.CustomerType; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Department; +import com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccount; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Enrollment; +import rx.functions.Func1; + +class BillingAccountImpl extends CreatableUpdatableImpl implements BillingAccount, BillingAccount.Update { + private String billingAccountName; + private BillingAccountUpdateRequest updateParameter; + private final BillingManager manager; + + BillingAccountImpl(String name, BillingManager manager) { + super(name, new BillingAccountInner()); + this.manager = manager; + // Set resource name + this.billingAccountName = name; + // + this.updateParameter = new BillingAccountUpdateRequest(); + } + + BillingAccountImpl(BillingAccountInner inner, BillingManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.billingAccountName = inner.name(); + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + // set other parameters for create and update + this.updateParameter = new BillingAccountUpdateRequest(); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + BillingAccountsInner client = this.manager().inner().billingAccounts(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + BillingAccountsInner client = this.manager().inner().billingAccounts(); + return client.updateAsync(this.billingAccountName, this.updateParameter) + .map(new Func1() { + @Override + public BillingAccountInner call(BillingAccountInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BillingAccountsInner client = this.manager().inner().billingAccounts(); + return client.getAsync(this.billingAccountName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new BillingAccountUpdateRequest(); + } + + @Override + public AccountType accountType() { + return this.inner().accountType(); + } + + @Override + public AddressDetails address() { + return this.inner().address(); + } + + @Override + public AgreementType agreementType() { + return this.inner().agreementType(); + } + + @Override + public List billingProfiles() { + List lst = new ArrayList(); + if (this.inner().billingProfiles() != null) { + for (BillingProfileInner inner : this.inner().billingProfiles()) { + lst.add( new BillingProfileImpl(inner, manager())); + } + } + return lst; + } + + @Override + public CustomerType customerType() { + return this.inner().customerType(); + } + + @Override + public List departments() { + List lst = new ArrayList(); + if (this.inner().departments() != null) { + for (DepartmentInner inner : this.inner().departments()) { + lst.add( new DepartmentImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List enrollmentAccounts() { + List lst = new ArrayList(); + if (this.inner().enrollmentAccounts() != null) { + for (EnrollmentAccountInner inner : this.inner().enrollmentAccounts()) { + lst.add( new EnrollmentAccountImpl(inner, manager())); + } + } + return lst; + } + + @Override + public Enrollment enrollmentDetails() { + return this.inner().enrollmentDetails(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String organizationId() { + return this.inner().organizationId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BillingAccountImpl withAddress(AddressDetails address) { + this.updateParameter.withAddress(address); + return this; + } + + @Override + public BillingAccountImpl withBillingProfiles(List billingProfiles) { + this.updateParameter.withBillingProfiles(billingProfiles); + return this; + } + + @Override + public BillingAccountImpl withDepartments(List departments) { + this.updateParameter.withDepartments(departments); + return this; + } + + @Override + public BillingAccountImpl withEnrollmentAccounts(List enrollmentAccounts) { + this.updateParameter.withEnrollmentAccounts(enrollmentAccounts); + 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/BillingAccountInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountInner.java new file mode 100644 index 0000000000000..82b031a0afb66 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountInner.java @@ -0,0 +1,226 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.AddressDetails; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AgreementType; +import com.microsoft.azure.management.billing.v2019_10_01_preview.CustomerType; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AccountType; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Enrollment; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing account. + */ +@JsonFlatten +public class BillingAccountInner extends ProxyResource { + /** + * The billing account name. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The address associated with the billing account. + */ + @JsonProperty(value = "properties.address") + private AddressDetails address; + + /** + * The type of agreement. Possible values include: + * 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', + * 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement'. + */ + @JsonProperty(value = "properties.agreementType", access = JsonProperty.Access.WRITE_ONLY) + private AgreementType agreementType; + + /** + * The type of customer. Possible values include: 'Enterprise', + * 'Individual', 'Partner'. + */ + @JsonProperty(value = "properties.customerType", access = JsonProperty.Access.WRITE_ONLY) + private CustomerType customerType; + + /** + * The type of customer. Possible values include: 'Enterprise', + * 'Individual', 'Partner'. + */ + @JsonProperty(value = "properties.accountType", access = JsonProperty.Access.WRITE_ONLY) + private AccountType accountType; + + /** + * The billing profiles associated with the billing account. By default + * this is not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.billingProfiles") + private List billingProfiles; + + /** + * The details about the associated legacy enrollment. By default this is + * not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.enrollmentDetails", access = JsonProperty.Access.WRITE_ONLY) + private Enrollment enrollmentDetails; + + /** + * The departments associated to the enrollment. + */ + @JsonProperty(value = "properties.departments") + private List departments; + + /** + * The accounts associated to the enrollment. + */ + @JsonProperty(value = "properties.enrollmentAccounts") + private List enrollmentAccounts; + + /** + * Organization id. + */ + @JsonProperty(value = "properties.organizationId", access = JsonProperty.Access.WRITE_ONLY) + private String organizationId; + + /** + * Get the billing account name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the address associated with the billing account. + * + * @return the address value + */ + public AddressDetails address() { + return this.address; + } + + /** + * Set the address associated with the billing account. + * + * @param address the address value to set + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withAddress(AddressDetails address) { + this.address = address; + return this; + } + + /** + * Get the type of agreement. Possible values include: 'MicrosoftCustomerAgreement', 'EnterpriseAgreement', 'MicrosoftOnlineServicesProgram', 'MicrosoftPartnerAgreement'. + * + * @return the agreementType value + */ + public AgreementType agreementType() { + return this.agreementType; + } + + /** + * Get the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner'. + * + * @return the customerType value + */ + public CustomerType customerType() { + return this.customerType; + } + + /** + * Get the type of customer. Possible values include: 'Enterprise', 'Individual', 'Partner'. + * + * @return the accountType value + */ + public AccountType accountType() { + return this.accountType; + } + + /** + * Get the billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. + * + * @return the billingProfiles value + */ + public List billingProfiles() { + return this.billingProfiles; + } + + /** + * Set the billing profiles associated with the billing account. By default this is not populated, unless it's specified in $expand. + * + * @param billingProfiles the billingProfiles value to set + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withBillingProfiles(List billingProfiles) { + this.billingProfiles = billingProfiles; + return this; + } + + /** + * Get the details about the associated legacy enrollment. By default this is not populated, unless it's specified in $expand. + * + * @return the enrollmentDetails value + */ + public Enrollment enrollmentDetails() { + return this.enrollmentDetails; + } + + /** + * Get the departments associated to the enrollment. + * + * @return the departments value + */ + public List departments() { + return this.departments; + } + + /** + * Set the departments associated to the enrollment. + * + * @param departments the departments value to set + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withDepartments(List departments) { + this.departments = departments; + return this; + } + + /** + * Get the accounts associated to the enrollment. + * + * @return the enrollmentAccounts value + */ + public List enrollmentAccounts() { + return this.enrollmentAccounts; + } + + /** + * Set the accounts associated to the enrollment. + * + * @param enrollmentAccounts the enrollmentAccounts value to set + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withEnrollmentAccounts(List enrollmentAccounts) { + this.enrollmentAccounts = enrollmentAccounts; + return this; + } + + /** + * Get organization id. + * + * @return the organizationId value + */ + public String organizationId() { + return this.organizationId; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountListResultImpl.java new file mode 100644 index 0000000000000..980cc887da0c3 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountListResultImpl.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.BillingAccountListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class BillingAccountListResultImpl extends WrapperImpl implements BillingAccountListResult { + private final BillingManager manager; + BillingAccountListResultImpl(BillingAccountListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountListResultInner.java new file mode 100644 index 0000000000000..7ae9428ba7c91 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountListResultInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of billing accounts. + */ +public class BillingAccountListResultInner { + /** + * The list of billing accounts. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of billing accounts. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountsImpl.java new file mode 100644 index 0000000000000..71dcf678fbaa5 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountsImpl.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccounts; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccount; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceSectionWithCreateSubPermission; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccountListResult; + +class BillingAccountsImpl extends WrapperImpl implements BillingAccounts { + private final BillingManager manager; + + BillingAccountsImpl(BillingManager manager) { + super(manager.inner().billingAccounts()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private BillingAccountImpl wrapModel(BillingAccountInner inner) { + return new BillingAccountImpl(inner, manager()); + } + + @Override + public Observable getAsync(String billingAccountName) { + BillingAccountsInner client = this.inner(); + return client.getAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingAccount call(BillingAccountInner inner) { + return new BillingAccountImpl(inner, manager()); + } + }); + } + + @Override + public Observable listInvoiceSectionsByCreateSubscriptionPermissionAsync(final String billingAccountName) { + BillingAccountsInner client = this.inner(); + return client.listInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InvoiceSectionWithCreateSubPermission call(InvoiceSectionWithCreateSubPermissionInner inner) { + return new InvoiceSectionWithCreateSubPermissionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + BillingAccountsInner client = this.inner(); + return client.listAsync() + .map(new Func1() { + @Override + public BillingAccountListResult call(BillingAccountListResultInner inner) { + return new BillingAccountListResultImpl(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/BillingAccountsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountsInner.java new file mode 100644 index 0000000000000..abd0f81814526 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingAccountsInner.java @@ -0,0 +1,752 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccountUpdateRequest; +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; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +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; + +/** + * An instance of this class provides access to all the operations defined + * in BillingAccounts. + */ +public class BillingAccountsInner { + /** The Retrofit service to perform REST calls. */ + private BillingAccountsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingAccountsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingAccountsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingAccountsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingAccounts to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingAccountsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccounts list" }) + @GET("providers/Microsoft.Billing/billingAccounts") + Observable> list(@Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccounts get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccounts update" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}") + Observable> update(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body BillingAccountUpdateRequest 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.BillingAccounts beginUpdate" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}") + Observable> beginUpdate(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body BillingAccountUpdateRequest 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.BillingAccounts listInvoiceSectionsByCreateSubscriptionPermission" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission") + Observable> listInvoiceSectionsByCreateSubscriptionPermission(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccounts listInvoiceSectionsByCreateSubscriptionPermissionNext" }) + @GET + Observable> listInvoiceSectionsByCreateSubscriptionPermissionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the billing accounts that a user has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingAccountListResultInner object if successful. + */ + public BillingAccountListResultInner list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountListResultInner object + */ + public Observable listAsync() { + return listWithServiceResponseAsync().map(new Func1, BillingAccountListResultInner>() { + @Override + public BillingAccountListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountListResultInner object + */ + public Observable> listWithServiceResponseAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.list(this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the address, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingAccountListResultInner object if successful. + */ + public BillingAccountListResultInner list(String expand) { + return listWithServiceResponseAsync(expand).toBlocking().single().body(); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the address, invoice sections and billing profiles. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listAsync(String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(expand), serviceCallback); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the address, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountListResultInner object + */ + public Observable listAsync(String expand) { + return listWithServiceResponseAsync(expand).map(new Func1, BillingAccountListResultInner>() { + @Override + public BillingAccountListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the address, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountListResultInner object + */ + public Observable> listWithServiceResponseAsync(String expand) { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a billing account by its ID. + * + * @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 BillingAccountInner object if successful. + */ + public BillingAccountInner get(String billingAccountName) { + return getWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Gets a billing account by its ID. + * + * @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 getAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable getAsync(String billingAccountName) { + return getWithServiceResponseAsync(billingAccountName).map(new Func1, BillingAccountInner>() { + @Override + public BillingAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.get(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the address, invoice sections and billing profiles. + * @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 BillingAccountInner object if successful. + */ + public BillingAccountInner get(String billingAccountName, String expand) { + return getWithServiceResponseAsync(billingAccountName, expand).toBlocking().single().body(); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the address, invoice sections and billing profiles. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, expand), serviceCallback); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the address, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable getAsync(String billingAccountName, String expand) { + return getWithServiceResponseAsync(billingAccountName, expand).map(new Func1, BillingAccountInner>() { + @Override + public BillingAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the address, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account 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 BillingAccountInner object if successful. + */ + public BillingAccountInner update(String billingAccountName, BillingAccountUpdateRequest parameters) { + return updateWithServiceResponseAsync(billingAccountName, parameters).toBlocking().last().body(); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String billingAccountName, BillingAccountUpdateRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String billingAccountName, BillingAccountUpdateRequest parameters) { + return updateWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingAccountInner>() { + @Override + public BillingAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, BillingAccountUpdateRequest 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); + Observable> observable = service.update(billingAccountName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account 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 BillingAccountInner object if successful. + */ + public BillingAccountInner beginUpdate(String billingAccountName, BillingAccountUpdateRequest parameters) { + return beginUpdateWithServiceResponseAsync(billingAccountName, parameters).toBlocking().single().body(); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String billingAccountName, BillingAccountUpdateRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable beginUpdateAsync(String billingAccountName, BillingAccountUpdateRequest parameters) { + return beginUpdateWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingAccountInner>() { + @Override + public BillingAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String billingAccountName, BillingAccountUpdateRequest 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.beginUpdate(billingAccountName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<InvoiceSectionWithCreateSubPermissionInner> object if successful. + */ + public PagedList listInvoiceSectionsByCreateSubscriptionPermission(final String billingAccountName) { + ServiceResponse> response = listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer 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> listInvoiceSectionsByCreateSubscriptionPermissionAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<InvoiceSectionWithCreateSubPermissionInner> object + */ + public Observable> listInvoiceSectionsByCreateSubscriptionPermissionAsync(final String billingAccountName) { + return listInvoiceSectionsByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<InvoiceSectionWithCreateSubPermissionInner> object + */ + public Observable>> listInvoiceSectionsByCreateSubscriptionPermissionWithServiceResponseAsync(final String billingAccountName) { + return listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(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(listInvoiceSectionsByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionWithCreateSubPermissionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(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.listInvoiceSectionsByCreateSubscriptionPermission(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listInvoiceSectionsByCreateSubscriptionPermissionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listInvoiceSectionsByCreateSubscriptionPermissionDelegate(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 invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<InvoiceSectionWithCreateSubPermissionInner> object if successful. + */ + public PagedList listInvoiceSectionsByCreateSubscriptionPermissionNext(final String nextPageLink) { + ServiceResponse> response = listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer 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> listInvoiceSectionsByCreateSubscriptionPermissionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<InvoiceSectionWithCreateSubPermissionInner> object + */ + public Observable> listInvoiceSectionsByCreateSubscriptionPermissionNextAsync(final String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<InvoiceSectionWithCreateSubPermissionInner> object + */ + public Observable>> listInvoiceSectionsByCreateSubscriptionPermissionNextWithServiceResponseAsync(final String nextPageLink) { + return listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(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(listInvoiceSectionsByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<InvoiceSectionWithCreateSubPermissionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(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.listInvoiceSectionsByCreateSubscriptionPermissionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listInvoiceSectionsByCreateSubscriptionPermissionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listInvoiceSectionsByCreateSubscriptionPermissionNextDelegate(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/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 new file mode 100644 index 0000000000000..4649091ce8b6a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManagementClientImpl.java @@ -0,0 +1,534 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the BillingManagementClientImpl class. + */ +public class BillingManagementClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The version of the API to be used with the client request. The current version is 2019-10-01-preview. */ + private String apiVersion; + + /** + * Gets The version of the API to be used with the client request. The current version is 2019-10-01-preview. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The ID that uniquely identifies an Azure subscription. */ + private String subscriptionId; + + /** + * Gets The ID that uniquely identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The ID that uniquely identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public BillingManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public BillingManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public BillingManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public BillingManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The BillingAccountsInner object to access its operations. + */ + private BillingAccountsInner billingAccounts; + + /** + * Gets the BillingAccountsInner object to access its operations. + * @return the BillingAccountsInner object. + */ + public BillingAccountsInner billingAccounts() { + return this.billingAccounts; + } + + /** + * The PaymentMethodsInner object to access its operations. + */ + private PaymentMethodsInner paymentMethods; + + /** + * Gets the PaymentMethodsInner object to access its operations. + * @return the PaymentMethodsInner object. + */ + public PaymentMethodsInner paymentMethods() { + return this.paymentMethods; + } + + /** + * The AddressInner object to access its operations. + */ + private AddressInner address; + + /** + * Gets the AddressInner object to access its operations. + * @return the AddressInner object. + */ + public AddressInner address() { + return this.address; + } + + /** + * The AvailableBalancesInner object to access its operations. + */ + private AvailableBalancesInner availableBalances; + + /** + * Gets the AvailableBalancesInner object to access its operations. + * @return the AvailableBalancesInner object. + */ + public AvailableBalancesInner availableBalances() { + return this.availableBalances; + } + + /** + * The InstructionsInner object to access its operations. + */ + private InstructionsInner instructions; + + /** + * Gets the InstructionsInner object to access its operations. + * @return the InstructionsInner object. + */ + public InstructionsInner instructions() { + return this.instructions; + } + + /** + * The BillingProfilesInner object to access its operations. + */ + private BillingProfilesInner billingProfiles; + + /** + * Gets the BillingProfilesInner object to access its operations. + * @return the BillingProfilesInner object. + */ + public BillingProfilesInner billingProfiles() { + return this.billingProfiles; + } + + /** + * The CustomersInner object to access its operations. + */ + private CustomersInner customers; + + /** + * Gets the CustomersInner object to access its operations. + * @return the CustomersInner object. + */ + public CustomersInner customers() { + return this.customers; + } + + /** + * The InvoiceSectionsInner object to access its operations. + */ + private InvoiceSectionsInner invoiceSections; + + /** + * Gets the InvoiceSectionsInner object to access its operations. + * @return the InvoiceSectionsInner object. + */ + public InvoiceSectionsInner invoiceSections() { + return this.invoiceSections; + } + + /** + * The BillingPermissionsInner object to access its operations. + */ + private BillingPermissionsInner billingPermissions; + + /** + * Gets the BillingPermissionsInner object to access its operations. + * @return the BillingPermissionsInner object. + */ + public BillingPermissionsInner billingPermissions() { + return this.billingPermissions; + } + + /** + * The BillingSubscriptionsInner object to access its operations. + */ + private BillingSubscriptionsInner billingSubscriptions; + + /** + * Gets the BillingSubscriptionsInner object to access its operations. + * @return the BillingSubscriptionsInner object. + */ + public BillingSubscriptionsInner billingSubscriptions() { + return this.billingSubscriptions; + } + + /** + * The ProductsInner object to access its operations. + */ + private ProductsInner products; + + /** + * Gets the ProductsInner object to access its operations. + * @return the ProductsInner object. + */ + public ProductsInner products() { + return this.products; + } + + /** + * The TransactionsInner object to access its operations. + */ + private TransactionsInner transactions; + + /** + * Gets the TransactionsInner object to access its operations. + * @return the TransactionsInner object. + */ + public TransactionsInner transactions() { + return this.transactions; + } + + /** + * The DepartmentsInner object to access its operations. + */ + private DepartmentsInner departments; + + /** + * Gets the DepartmentsInner object to access its operations. + * @return the DepartmentsInner object. + */ + public DepartmentsInner departments() { + return this.departments; + } + + /** + * The EnrollmentAccountsInner object to access its operations. + */ + private EnrollmentAccountsInner enrollmentAccounts; + + /** + * Gets the EnrollmentAccountsInner object to access its operations. + * @return the EnrollmentAccountsInner object. + */ + public EnrollmentAccountsInner enrollmentAccounts() { + return this.enrollmentAccounts; + } + + /** + * The InvoicesInner object to access its operations. + */ + private InvoicesInner invoices; + + /** + * Gets the InvoicesInner object to access its operations. + * @return the InvoicesInner object. + */ + public InvoicesInner invoices() { + return this.invoices; + } + + /** + * The PriceSheetsInner object to access its operations. + */ + private PriceSheetsInner priceSheets; + + /** + * Gets the PriceSheetsInner object to access its operations. + * @return the PriceSheetsInner object. + */ + public PriceSheetsInner priceSheets() { + return this.priceSheets; + } + + /** + * The PoliciesInner object to access its operations. + */ + private PoliciesInner policies; + + /** + * Gets the PoliciesInner object to access its operations. + * @return the PoliciesInner object. + */ + public PoliciesInner policies() { + return this.policies; + } + + /** + * The BillingPropertysInner object to access its operations. + */ + private BillingPropertysInner billingPropertys; + + /** + * Gets the BillingPropertysInner object to access its operations. + * @return the BillingPropertysInner object. + */ + public BillingPropertysInner billingPropertys() { + return this.billingPropertys; + } + + /** + * The TransfersInner object to access its operations. + */ + private TransfersInner transfers; + + /** + * Gets the TransfersInner object to access its operations. + * @return the TransfersInner object. + */ + public TransfersInner transfers() { + return this.transfers; + } + + /** + * The PartnerTransfersInner object to access its operations. + */ + private PartnerTransfersInner partnerTransfers; + + /** + * Gets the PartnerTransfersInner object to access its operations. + * @return the PartnerTransfersInner object. + */ + public PartnerTransfersInner partnerTransfers() { + return this.partnerTransfers; + } + + /** + * The RecipientTransfersInner object to access its operations. + */ + private RecipientTransfersInner recipientTransfers; + + /** + * Gets the RecipientTransfersInner object to access its operations. + * @return the RecipientTransfersInner object. + */ + public RecipientTransfersInner recipientTransfers() { + return this.recipientTransfers; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The BillingRoleDefinitionsInner object to access its operations. + */ + private BillingRoleDefinitionsInner billingRoleDefinitions; + + /** + * Gets the BillingRoleDefinitionsInner object to access its operations. + * @return the BillingRoleDefinitionsInner object. + */ + public BillingRoleDefinitionsInner billingRoleDefinitions() { + return this.billingRoleDefinitions; + } + + /** + * The BillingRoleAssignmentsInner object to access its operations. + */ + private BillingRoleAssignmentsInner billingRoleAssignments; + + /** + * Gets the BillingRoleAssignmentsInner object to access its operations. + * @return the BillingRoleAssignmentsInner object. + */ + public BillingRoleAssignmentsInner billingRoleAssignments() { + return this.billingRoleAssignments; + } + + /** + * The AgreementsInner object to access its operations. + */ + private AgreementsInner agreements; + + /** + * Gets the AgreementsInner object to access its operations. + * @return the AgreementsInner object. + */ + public AgreementsInner agreements() { + return this.agreements; + } + + /** + * Initializes an instance of BillingManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public BillingManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of BillingManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public BillingManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of BillingManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public BillingManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2019-10-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.billingAccounts = new BillingAccountsInner(restClient().retrofit(), this); + this.paymentMethods = new PaymentMethodsInner(restClient().retrofit(), this); + this.address = new AddressInner(restClient().retrofit(), this); + this.availableBalances = new AvailableBalancesInner(restClient().retrofit(), this); + this.instructions = new InstructionsInner(restClient().retrofit(), this); + this.billingProfiles = new BillingProfilesInner(restClient().retrofit(), this); + this.customers = new CustomersInner(restClient().retrofit(), this); + this.invoiceSections = new InvoiceSectionsInner(restClient().retrofit(), this); + this.billingPermissions = new BillingPermissionsInner(restClient().retrofit(), this); + this.billingSubscriptions = new BillingSubscriptionsInner(restClient().retrofit(), this); + this.products = new ProductsInner(restClient().retrofit(), this); + this.transactions = new TransactionsInner(restClient().retrofit(), this); + this.departments = new DepartmentsInner(restClient().retrofit(), this); + this.enrollmentAccounts = new EnrollmentAccountsInner(restClient().retrofit(), this); + this.invoices = new InvoicesInner(restClient().retrofit(), this); + this.priceSheets = new PriceSheetsInner(restClient().retrofit(), this); + this.policies = new PoliciesInner(restClient().retrofit(), this); + this.billingPropertys = new BillingPropertysInner(restClient().retrofit(), this); + this.transfers = new TransfersInner(restClient().retrofit(), this); + this.partnerTransfers = new PartnerTransfersInner(restClient().retrofit(), this); + this.recipientTransfers = new RecipientTransfersInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.billingRoleDefinitions = new BillingRoleDefinitionsInner(restClient().retrofit(), this); + this.billingRoleAssignments = new BillingRoleAssignmentsInner(restClient().retrofit(), this); + this.agreements = new AgreementsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "BillingManagementClient", "2019-10-01-preview"); + } +} 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 new file mode 100644 index 0000000000000..de192c8915305 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingManager.java @@ -0,0 +1,387 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingAccounts; +import com.microsoft.azure.management.billing.v2019_10_01_preview.PaymentMethods; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Address; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AvailableBalances; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Instructions; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfiles; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Customers; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceSections; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissions; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscriptions; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Products; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Transactions; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Departments; +import com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccounts; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Invoices; +import com.microsoft.azure.management.billing.v2019_10_01_preview.PriceSheets; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Policies; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPropertys; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Transfers; +import com.microsoft.azure.management.billing.v2019_10_01_preview.PartnerTransfers; +import com.microsoft.azure.management.billing.v2019_10_01_preview.RecipientTransfers; +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.Agreements; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Billing resource management. + */ +public final class BillingManager extends ManagerCore { + private BillingAccounts billingAccounts; + private PaymentMethods paymentMethods; + private Address address; + private AvailableBalances availableBalances; + private Instructions instructions; + private BillingProfiles billingProfiles; + private Customers customers; + private InvoiceSections invoiceSections; + private BillingPermissions billingPermissions; + private BillingSubscriptions billingSubscriptions; + private Products products; + private Transactions transactions; + private Departments departments; + private EnrollmentAccounts enrollmentAccounts; + private Invoices invoices; + private PriceSheets priceSheets; + private Policies policies; + private BillingPropertys billingPropertys; + private Transfers transfers; + private PartnerTransfers partnerTransfers; + private RecipientTransfers recipientTransfers; + private Operations operations; + private BillingRoleDefinitions billingRoleDefinitions; + private BillingRoleAssignments billingRoleAssignments; + private Agreements agreements; + /** + * Get a Configurable instance that can be used to create BillingManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new BillingManager.ConfigurableImpl(); + } + /** + * Creates an instance of BillingManager that exposes Billing resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the BillingManager + */ + public static BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new BillingManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of BillingManager that exposes Billing resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the BillingManager + */ + public static BillingManager authenticate(RestClient restClient, String subscriptionId) { + return new BillingManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of BillingManager that exposes Billing management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Billing management API entry points that work across subscriptions + */ + BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage BillingAccounts. + */ + public BillingAccounts billingAccounts() { + if (this.billingAccounts == null) { + this.billingAccounts = new BillingAccountsImpl(this); + } + return this.billingAccounts; + } + + /** + * @return Entry point to manage PaymentMethods. + */ + public PaymentMethods paymentMethods() { + if (this.paymentMethods == null) { + this.paymentMethods = new PaymentMethodsImpl(this); + } + return this.paymentMethods; + } + + /** + * @return Entry point to manage Address. + */ + public Address address() { + if (this.address == null) { + this.address = new AddressImpl(this); + } + return this.address; + } + + /** + * @return Entry point to manage AvailableBalances. + */ + public AvailableBalances availableBalances() { + if (this.availableBalances == null) { + this.availableBalances = new AvailableBalancesImpl(this); + } + return this.availableBalances; + } + + /** + * @return Entry point to manage Instructions. + */ + public Instructions instructions() { + if (this.instructions == null) { + this.instructions = new InstructionsImpl(this); + } + return this.instructions; + } + + /** + * @return Entry point to manage BillingProfiles. + */ + public BillingProfiles billingProfiles() { + if (this.billingProfiles == null) { + this.billingProfiles = new BillingProfilesImpl(this); + } + return this.billingProfiles; + } + + /** + * @return Entry point to manage Customers. + */ + public Customers customers() { + if (this.customers == null) { + this.customers = new CustomersImpl(this); + } + return this.customers; + } + + /** + * @return Entry point to manage InvoiceSections. + */ + public InvoiceSections invoiceSections() { + if (this.invoiceSections == null) { + this.invoiceSections = new InvoiceSectionsImpl(this); + } + return this.invoiceSections; + } + + /** + * @return Entry point to manage BillingPermissions. + */ + public BillingPermissions billingPermissions() { + if (this.billingPermissions == null) { + this.billingPermissions = new BillingPermissionsImpl(this); + } + return this.billingPermissions; + } + + /** + * @return Entry point to manage BillingSubscriptions. + */ + public BillingSubscriptions billingSubscriptions() { + if (this.billingSubscriptions == null) { + this.billingSubscriptions = new BillingSubscriptionsImpl(this); + } + return this.billingSubscriptions; + } + + /** + * @return Entry point to manage Products. + */ + public Products products() { + if (this.products == null) { + this.products = new ProductsImpl(this); + } + return this.products; + } + + /** + * @return Entry point to manage Transactions. + */ + public Transactions transactions() { + if (this.transactions == null) { + this.transactions = new TransactionsImpl(this); + } + return this.transactions; + } + + /** + * @return Entry point to manage Departments. + */ + public Departments departments() { + if (this.departments == null) { + this.departments = new DepartmentsImpl(this); + } + return this.departments; + } + + /** + * @return Entry point to manage EnrollmentAccounts. + */ + public EnrollmentAccounts enrollmentAccounts() { + if (this.enrollmentAccounts == null) { + this.enrollmentAccounts = new EnrollmentAccountsImpl(this); + } + return this.enrollmentAccounts; + } + + /** + * @return Entry point to manage Invoices. + */ + public Invoices invoices() { + if (this.invoices == null) { + this.invoices = new InvoicesImpl(this); + } + return this.invoices; + } + + /** + * @return Entry point to manage PriceSheets. + */ + public PriceSheets priceSheets() { + if (this.priceSheets == null) { + this.priceSheets = new PriceSheetsImpl(this); + } + return this.priceSheets; + } + + /** + * @return Entry point to manage Policies. + */ + public Policies policies() { + if (this.policies == null) { + this.policies = new PoliciesImpl(this); + } + return this.policies; + } + + /** + * @return Entry point to manage BillingPropertys. + */ + public BillingPropertys billingPropertys() { + if (this.billingPropertys == null) { + this.billingPropertys = new BillingPropertysImpl(this); + } + return this.billingPropertys; + } + + /** + * @return Entry point to manage Transfers. + */ + public Transfers transfers() { + if (this.transfers == null) { + this.transfers = new TransfersImpl(this); + } + return this.transfers; + } + + /** + * @return Entry point to manage PartnerTransfers. + */ + public PartnerTransfers partnerTransfers() { + if (this.partnerTransfers == null) { + this.partnerTransfers = new PartnerTransfersImpl(this); + } + return this.partnerTransfers; + } + + /** + * @return Entry point to manage RecipientTransfers. + */ + public RecipientTransfers recipientTransfers() { + if (this.recipientTransfers == null) { + this.recipientTransfers = new RecipientTransfersImpl(this); + } + return this.recipientTransfers; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage BillingRoleDefinitions. + */ + public BillingRoleDefinitions billingRoleDefinitions() { + if (this.billingRoleDefinitions == null) { + this.billingRoleDefinitions = new BillingRoleDefinitionsImpl(this); + } + return this.billingRoleDefinitions; + } + + /** + * @return Entry point to manage BillingRoleAssignments. + */ + public BillingRoleAssignments billingRoleAssignments() { + if (this.billingRoleAssignments == null) { + this.billingRoleAssignments = new BillingRoleAssignmentsImpl(this); + } + return this.billingRoleAssignments; + } + + /** + * @return Entry point to manage Agreements. + */ + public Agreements agreements() { + if (this.agreements == null) { + this.agreements = new AgreementsImpl(this); + } + return this.agreements; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return BillingManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private BillingManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new BillingManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsImpl.java new file mode 100644 index 0000000000000..5116d44e3d72b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsImpl.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +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.BillingPermissions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissionsListResult; + +class BillingPermissionsImpl extends WrapperImpl implements BillingPermissions { + private final BillingManager manager; + + BillingPermissionsImpl(BillingManager manager) { + super(manager.inner().billingPermissions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable listByCustomerAsync(String billingAccountName, String customerName) { + BillingPermissionsInner client = this.inner(); + return client.listByCustomerAsync(billingAccountName, customerName) + .map(new Func1() { + @Override + public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { + return new BillingPermissionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(String billingAccountName) { + BillingPermissionsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { + return new BillingPermissionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionsAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + BillingPermissionsInner client = this.inner(); + return client.listByInvoiceSectionsAsync(billingAccountName, billingProfileName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { + return new BillingPermissionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + BillingPermissionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { + return new BillingPermissionsListResultImpl(inner, manager()); + } + }); + } + +} diff --git a/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 new file mode 100644 index 0000000000000..20bb94e744ba3 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsInner.java @@ -0,0 +1,404 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingPermissions. + */ +public class BillingPermissionsInner { + /** The Retrofit service to perform REST calls. */ + private BillingPermissionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingPermissionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingPermissionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingPermissionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingPermissions to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingPermissionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissions listByCustomer" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions") + Observable> listByCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissions listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissions listByInvoiceSections" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions") + Observable> listByInvoiceSections(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissions listByBillingProfile" }) + @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); + + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByCustomer(String billingAccountName, String customerName) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 listByCustomerAsync(String billingAccountName, String customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByCustomerWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable listByCustomerAsync(String billingAccountName, String customerName) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable> listByCustomerWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByCustomer(billingAccountName, customerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByCustomerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByCustomerDelegate(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 billing permissions the caller has on a billing account. + * + * @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 BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByBillingAccount(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @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(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @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 + */ + public Observable listByBillingAccountAsync(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @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 + */ + public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @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 BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByInvoiceSections(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return listByInvoiceSectionsWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @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 listByInvoiceSectionsAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByInvoiceSectionsWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName), serviceCallback); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @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 BillingPermissionsListResultInner object + */ + public Observable listByInvoiceSectionsAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return listByInvoiceSectionsWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @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 BillingPermissionsListResultInner object + */ + public Observable> listByInvoiceSectionsWithServiceResponseAsync(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.listByInvoiceSections(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 = listByInvoiceSectionsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByInvoiceSectionsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @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 BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByBillingProfile(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @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 billing permissions the caller has on a billing profile. + * + * @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 BillingPermissionsListResultInner object + */ + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @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 BillingPermissionsListResultInner object + */ + public Observable> listByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/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 new file mode 100644 index 0000000000000..3aa47d32be2ec --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultImpl.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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; + BillingPermissionsListResultImpl(BillingPermissionsListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + 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 new file mode 100644 index 0000000000000..0bba27416ebd2 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPermissionsListResultInner.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissionsProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of list billingPermissions a caller has on a billing account. + */ +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; + + /** + * Get the list of billingPermissions a caller has on a billing account. + * + * @return the value 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/BillingProfileImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileImpl.java new file mode 100644 index 0000000000000..1459414c1e58a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileImpl.java @@ -0,0 +1,237 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingProfile; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AddressDetails; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AzurePlan; +import com.microsoft.azure.management.billing.v2019_10_01_preview.StatusReasonCode; +import com.microsoft.azure.management.billing.v2019_10_01_preview.SpendingLimit; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfileCreationRequest; +import java.util.ArrayList; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceSection; +import rx.functions.Func1; + +class BillingProfileImpl extends CreatableUpdatableImpl implements BillingProfile, BillingProfile.Definition, BillingProfile.Update { + private final BillingManager manager; + private String billingAccountName; + private String billingProfileName; + private BillingProfileCreationRequest createParameter; + + BillingProfileImpl(String name, BillingManager manager) { + super(name, new BillingProfileInner()); + this.manager = manager; + // Set resource name + this.billingProfileName = name; + // + this.createParameter = new BillingProfileCreationRequest(); + } + + BillingProfileImpl(BillingProfileInner inner, BillingManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.billingProfileName = inner.name(); + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.billingProfileName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingProfiles"); + // + this.createParameter = new BillingProfileCreationRequest(); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + BillingProfilesInner client = this.manager().inner().billingProfiles(); + return client.createAsync(this.billingAccountName, this.billingProfileName, this.createParameter) + .map(new Func1() { + @Override + public BillingProfileInner call(BillingProfileInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + BillingProfilesInner client = this.manager().inner().billingProfiles(); + return client.updateAsync(this.billingAccountName, this.billingProfileName, this.inner()) + .map(new Func1() { + @Override + public BillingProfileInner call(BillingProfileInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + BillingProfilesInner client = this.manager().inner().billingProfiles(); + return client.getAsync(this.billingAccountName, this.billingProfileName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createParameter = new BillingProfileCreationRequest(); + } + + @Override + public AddressDetails address() { + return this.inner().address(); + } + + @Override + public String currency() { + return this.inner().currency(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List enabledAzurePlans() { + return this.inner().enabledAzurePlans(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Integer invoiceDay() { + return this.inner().invoiceDay(); + } + + @Override + public Boolean invoiceEmailOptIn() { + return this.inner().invoiceEmailOptIn(); + } + + @Override + public List invoiceSections() { + List lst = new ArrayList(); + if (this.inner().invoiceSections() != null) { + for (InvoiceSectionInner inner : this.inner().invoiceSections()) { + lst.add( new InvoiceSectionImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String poNumber() { + return this.inner().poNumber(); + } + + @Override + public SpendingLimit spendingLimit() { + return this.inner().spendingLimit(); + } + + @Override + public Object status() { + return this.inner().status(); + } + + @Override + public StatusReasonCode statusReasonCode() { + return this.inner().statusReasonCode(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BillingProfileImpl withExistingBillingAccount(String billingAccountName) { + this.billingAccountName = billingAccountName; + return this; + } + + @Override + public BillingProfileImpl withInvoiceSections(List invoiceSections) { + this.inner().withInvoiceSections(invoiceSections); + return this; + } + + @Override + public BillingProfileImpl withAddress(AddressDetails address) { + if (isInCreateMode()) { + this.createParameter.withAddress(address); + } else { + this.inner().withAddress(address); + } + return this; + } + + @Override + public BillingProfileImpl withDisplayName(String displayName) { + if (isInCreateMode()) { + this.createParameter.withDisplayName(displayName); + } else { + this.inner().withDisplayName(displayName); + } + return this; + } + + @Override + public BillingProfileImpl withEnabledAzurePlans(List enabledAzurePlans) { + if (isInCreateMode()) { + this.createParameter.withEnabledAzurePlans(enabledAzurePlans); + } else { + this.inner().withEnabledAzurePlans(enabledAzurePlans); + } + return this; + } + + @Override + public BillingProfileImpl withInvoiceEmailOptIn(Boolean invoiceEmailOptIn) { + if (isInCreateMode()) { + this.createParameter.withInvoiceEmailOptIn(invoiceEmailOptIn); + } else { + this.inner().withInvoiceEmailOptIn(invoiceEmailOptIn); + } + return this; + } + + @Override + public BillingProfileImpl withPoNumber(String poNumber) { + if (isInCreateMode()) { + this.createParameter.withPoNumber(poNumber); + } else { + this.inner().withPoNumber(poNumber); + } + 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/BillingProfileInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileInner.java new file mode 100644 index 0000000000000..3e2089134d2be --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileInner.java @@ -0,0 +1,261 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.AddressDetails; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AzurePlan; +import com.microsoft.azure.management.billing.v2019_10_01_preview.StatusReasonCode; +import com.microsoft.azure.management.billing.v2019_10_01_preview.SpendingLimit; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing profile. + */ +@JsonFlatten +public class BillingProfileInner extends ProxyResource { + /** + * The name of the billing profile. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The purchase order name that will appear on the invoices generated for + * the billing profile. + */ + @JsonProperty(value = "properties.poNumber") + private String poNumber; + + /** + * Billing address. + */ + @JsonProperty(value = "properties.address") + private AddressDetails address; + + /** + * Flag controlling whether the invoices for the billing profile are sent + * through email. + */ + @JsonProperty(value = "properties.invoiceEmailOptIn") + private Boolean invoiceEmailOptIn; + + /** + * The day of the month when the invoice for the billing profile is + * generated. + */ + @JsonProperty(value = "properties.invoiceDay", access = JsonProperty.Access.WRITE_ONLY) + private Integer invoiceDay; + + /** + * The currency in which the charges for the billing profile are billed. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * Information about the enabled azure plans. + */ + @JsonProperty(value = "properties.enabledAzurePlans") + private List enabledAzurePlans; + + /** + * The invoice sections associated to the billing profile. + */ + @JsonProperty(value = "properties.invoiceSections") + private List invoiceSections; + + /** + * The status of the billing profile. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private Object status; + + /** + * Reason for the specified billing profile status. Possible values + * include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired'. + */ + @JsonProperty(value = "properties.statusReasonCode", access = JsonProperty.Access.WRITE_ONLY) + private StatusReasonCode statusReasonCode; + + /** + * The billing profile spending limit. Possible values include: 'Off', + * 'On'. + */ + @JsonProperty(value = "properties.spendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private SpendingLimit spendingLimit; + + /** + * Get the name of the billing profile. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the billing profile. + * + * @param displayName the displayName value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the purchase order name that will appear on the invoices generated for the billing profile. + * + * @return the poNumber value + */ + public String poNumber() { + return this.poNumber; + } + + /** + * Set the purchase order name that will appear on the invoices generated for the billing profile. + * + * @param poNumber the poNumber value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withPoNumber(String poNumber) { + this.poNumber = poNumber; + return this; + } + + /** + * Get billing address. + * + * @return the address value + */ + public AddressDetails address() { + return this.address; + } + + /** + * Set billing address. + * + * @param address the address value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withAddress(AddressDetails address) { + this.address = address; + return this; + } + + /** + * Get flag controlling whether the invoices for the billing profile are sent through email. + * + * @return the invoiceEmailOptIn value + */ + public Boolean invoiceEmailOptIn() { + return this.invoiceEmailOptIn; + } + + /** + * Set flag controlling whether the invoices for the billing profile are sent through email. + * + * @param invoiceEmailOptIn the invoiceEmailOptIn value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withInvoiceEmailOptIn(Boolean invoiceEmailOptIn) { + this.invoiceEmailOptIn = invoiceEmailOptIn; + return this; + } + + /** + * Get the day of the month when the invoice for the billing profile is generated. + * + * @return the invoiceDay value + */ + public Integer invoiceDay() { + return this.invoiceDay; + } + + /** + * Get the currency in which the charges for the billing profile are billed. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get information about the enabled azure plans. + * + * @return the enabledAzurePlans value + */ + public List enabledAzurePlans() { + return this.enabledAzurePlans; + } + + /** + * Set information about the enabled azure plans. + * + * @param enabledAzurePlans the enabledAzurePlans value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withEnabledAzurePlans(List enabledAzurePlans) { + this.enabledAzurePlans = enabledAzurePlans; + return this; + } + + /** + * Get the invoice sections associated to the billing profile. + * + * @return the invoiceSections value + */ + public List invoiceSections() { + return this.invoiceSections; + } + + /** + * Set the invoice sections associated to the billing profile. + * + * @param invoiceSections the invoiceSections value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withInvoiceSections(List invoiceSections) { + this.invoiceSections = invoiceSections; + return this; + } + + /** + * Get the status of the billing profile. + * + * @return the status value + */ + public Object status() { + return this.status; + } + + /** + * Get reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired'. + * + * @return the statusReasonCode value + */ + public StatusReasonCode statusReasonCode() { + return this.statusReasonCode; + } + + /** + * Get the billing profile spending limit. Possible values include: 'Off', 'On'. + * + * @return the spendingLimit value + */ + public SpendingLimit spendingLimit() { + return this.spendingLimit; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileListResultImpl.java new file mode 100644 index 0000000000000..ac5f07f76d4e6 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileListResultImpl.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.BillingProfileListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class BillingProfileListResultImpl extends WrapperImpl implements BillingProfileListResult { + private final BillingManager manager; + BillingProfileListResultImpl(BillingProfileListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileListResultInner.java new file mode 100644 index 0000000000000..ad70a8d5b0b51 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfileListResultInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of billing profiles. + */ +public class BillingProfileListResultInner { + /** + * The list of billing profiles. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of billing profiles. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfilesImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfilesImpl.java new file mode 100644 index 0000000000000..13deb70c3a90e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfilesImpl.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfiles; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfileListResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfile; + +class BillingProfilesImpl extends WrapperImpl implements BillingProfiles { + private final BillingManager manager; + + BillingProfilesImpl(BillingManager manager) { + super(manager.inner().billingProfiles()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public BillingProfileImpl define(String name) { + return wrapModel(name); + } + + private BillingProfileImpl wrapModel(BillingProfileInner inner) { + return new BillingProfileImpl(inner, manager()); + } + + private BillingProfileImpl wrapModel(String name) { + return new BillingProfileImpl(name, this.manager()); + } + + @Override + public Observable listByBillingAccountAsync(String billingAccountName) { + BillingProfilesInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingProfileListResult call(BillingProfileListResultInner inner) { + return new BillingProfileListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName) { + BillingProfilesInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName) + .flatMap(new Func1>() { + @Override + public Observable call(BillingProfileInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((BillingProfile)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/BillingProfilesInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfilesInner.java new file mode 100644 index 0000000000000..993654bdabae3 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingProfilesInner.java @@ -0,0 +1,734 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingProfileCreationRequest; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfilesCreateHeaders; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfilesUpdateHeaders; +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.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +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 BillingProfiles. + */ +public class BillingProfilesInner { + /** The Retrofit service to perform REST calls. */ + private BillingProfilesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingProfilesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingProfilesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingProfilesService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingProfiles to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingProfilesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfiles listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfiles get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfiles create" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + Observable> create(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body BillingProfileCreationRequest 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.BillingProfiles beginCreate" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + Observable> beginCreate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body BillingProfileCreationRequest 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.BillingProfiles update" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + Observable> update(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body BillingProfileInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfiles beginUpdate" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + Observable> beginUpdate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body BillingProfileInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 BillingProfileListResultInner object if successful. + */ + public BillingProfileListResultInner listByBillingAccount(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileListResultInner object + */ + public Observable listByBillingAccountAsync(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, BillingProfileListResultInner>() { + @Override + public BillingProfileListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileListResultInner object + */ + public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingProfileListResultInner object if successful. + */ + public BillingProfileListResultInner listByBillingAccount(String billingAccountName, String expand) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, expand).toBlocking().single().body(); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @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, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName, expand), serviceCallback); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileListResultInner object + */ + public Observable listByBillingAccountAsync(String billingAccountName, String expand) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, expand).map(new Func1, BillingProfileListResultInner>() { + @Override + public BillingProfileListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileListResultInner object + */ + public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 BillingProfileInner object if successful. + */ + public BillingProfileInner get(String billingAccountName, String billingProfileName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 getAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 BillingProfileInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 BillingProfileInner object + */ + public Observable> getWithServiceResponseAsync(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."); + } + final String expand = null; + return service.get(billingAccountName, billingProfileName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @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 BillingProfileInner object if successful. + */ + public BillingProfileInner get(String billingAccountName, String billingProfileName, String expand) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, expand).toBlocking().single().body(); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String billingProfileName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, expand), serviceCallback); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String expand) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, expand).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName, String expand) { + 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.get(billingAccountName, billingProfileName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 profile 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 BillingProfileInner object if successful. + */ + public BillingProfileInner create(String billingAccountName, String billingProfileName, BillingProfileCreationRequest parameters) { + return createWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().last().body(); + } + + /** + * Creates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 profile 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 createAsync(String billingAccountName, String billingProfileName, BillingProfileCreationRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * Creates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String billingAccountName, String billingProfileName, BillingProfileCreationRequest parameters) { + return createWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String billingAccountName, String billingProfileName, BillingProfileCreationRequest 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); + Observable> observable = service.create(billingAccountName, billingProfileName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingProfilesCreateHeaders.class); + } + + /** + * Creates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 profile 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 BillingProfileInner object if successful. + */ + public BillingProfileInner beginCreate(String billingAccountName, String billingProfileName, BillingProfileCreationRequest parameters) { + return beginCreateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().single().body(); + } + + /** + * Creates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 profile 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 beginCreateAsync(String billingAccountName, String billingProfileName, BillingProfileCreationRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * Creates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable beginCreateAsync(String billingAccountName, String billingProfileName, BillingProfileCreationRequest parameters) { + return beginCreateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String billingAccountName, String billingProfileName, BillingProfileCreationRequest 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.beginCreate(billingAccountName, billingProfileName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginCreateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, BillingProfilesCreateHeaders.class); + } + + /** + * Updates the properties of a billing profile. Currently, displayName, poNumber, bill-to address and invoiceEmailOptIn can be updated. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 supplied to the update billing profile 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 BillingProfileInner object if successful. + */ + public BillingProfileInner update(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().last().body(); + } + + /** + * Updates the properties of a billing profile. Currently, displayName, poNumber, bill-to address and invoiceEmailOptIn can be updated. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 supplied to the update billing profile operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String billingAccountName, String billingProfileName, BillingProfileInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * Updates the properties of a billing profile. Currently, displayName, poNumber, bill-to address and invoiceEmailOptIn can be updated. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 supplied to the update billing profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of a billing profile. Currently, displayName, poNumber, bill-to address and invoiceEmailOptIn can be updated. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 supplied to the update billing profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, String billingProfileName, BillingProfileInner 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); + Observable> observable = service.update(billingAccountName, billingProfileName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingProfilesUpdateHeaders.class); + } + + /** + * Updates the properties of a billing profile. Currently, displayName, poNumber, bill-to address and invoiceEmailOptIn can be updated. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 supplied to the update billing profile 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 BillingProfileInner object if successful. + */ + public BillingProfileInner beginUpdate(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + return beginUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().single().body(); + } + + /** + * Updates the properties of a billing profile. Currently, displayName, poNumber, bill-to address and invoiceEmailOptIn can be updated. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 supplied to the update billing profile 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 beginUpdateAsync(String billingAccountName, String billingProfileName, BillingProfileInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * Updates the properties of a billing profile. Currently, displayName, poNumber, bill-to address and invoiceEmailOptIn can be updated. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 supplied to the update billing profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable beginUpdateAsync(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + return beginUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates the properties of a billing profile. Currently, displayName, poNumber, bill-to address and invoiceEmailOptIn can be updated. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 supplied to the update billing profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String billingAccountName, String billingProfileName, BillingProfileInner 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.beginUpdate(billingAccountName, billingProfileName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, BillingProfilesUpdateHeaders.class); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertyImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertyImpl.java new file mode 100644 index 0000000000000..2dc0b8f5fd064 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertyImpl.java @@ -0,0 +1,117 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingProperty; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfileStatus; + +class BillingPropertyImpl extends WrapperImpl implements BillingProperty { + private final BillingManager manager; + BillingPropertyImpl(BillingPropertyInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String billingAccountDisplayName() { + return this.inner().billingAccountDisplayName(); + } + + @Override + public String billingAccountId() { + return this.inner().billingAccountId(); + } + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public Object billingProfileSpendingLimit() { + return this.inner().billingProfileSpendingLimit(); + } + + @Override + public BillingProfileStatus billingProfileStatus() { + return this.inner().billingProfileStatus(); + } + + @Override + public Object billingProfileStatusReasonCode() { + return this.inner().billingProfileStatusReasonCode(); + } + + @Override + public String billingTenantId() { + return this.inner().billingTenantId(); + } + + @Override + public String costCenter() { + return this.inner().costCenter(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoiceSectionDisplayName() { + return this.inner().invoiceSectionDisplayName(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String productId() { + return this.inner().productId(); + } + + @Override + public String productName() { + return this.inner().productName(); + } + + @Override + public String skuDescription() { + return this.inner().skuDescription(); + } + + @Override + public String skuId() { + return this.inner().skuId(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertyInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertyInner.java new file mode 100644 index 0000000000000..c308564311f71 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertyInner.java @@ -0,0 +1,247 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingProfileStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing property. + */ +@JsonFlatten +public class BillingPropertyInner extends ProxyResource { + /** + * The Azure AD tenant ID of the billing account for the subscription. + */ + @JsonProperty(value = "properties.billingTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String billingTenantId; + + /** + * The ID of the billing account to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingAccountId", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountId; + + /** + * The name of the billing account to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingAccountDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountDisplayName; + + /** + * The ID of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * The status of the billing profile. Possible values include: 'Active', + * 'Disabled', 'Warned'. + */ + @JsonProperty(value = "properties.billingProfileStatus", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileStatus billingProfileStatus; + + /** + * Reason for the specified billing profile status. + */ + @JsonProperty(value = "properties.billingProfileStatusReasonCode", access = JsonProperty.Access.WRITE_ONLY) + private Object billingProfileStatusReasonCode; + + /** + * The billing profile spending limit. + */ + @JsonProperty(value = "properties.billingProfileSpendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private Object billingProfileSpendingLimit; + + /** + * The cost center applied to the subscription. + */ + @JsonProperty(value = "properties.costCenter", access = JsonProperty.Access.WRITE_ONLY) + private String costCenter; + + /** + * The ID of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * The name of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /** + * The product ID of the Azure plan. + */ + @JsonProperty(value = "properties.productId", access = JsonProperty.Access.WRITE_ONLY) + private String productId; + + /** + * The product name of the Azure plan. + */ + @JsonProperty(value = "properties.productName", access = JsonProperty.Access.WRITE_ONLY) + private String productName; + + /** + * The sku ID of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuId", access = JsonProperty.Access.WRITE_ONLY) + private String skuId; + + /** + * The sku description of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * Get the Azure AD tenant ID of the billing account for the subscription. + * + * @return the billingTenantId value + */ + public String billingTenantId() { + return this.billingTenantId; + } + + /** + * Get the ID of the billing account to which the subscription is billed. + * + * @return the billingAccountId value + */ + public String billingAccountId() { + return this.billingAccountId; + } + + /** + * Get the name of the billing account to which the subscription is billed. + * + * @return the billingAccountDisplayName value + */ + public String billingAccountDisplayName() { + return this.billingAccountDisplayName; + } + + /** + * Get the ID of the billing profile to which the subscription is billed. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile to which the subscription is billed. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the status of the billing profile. Possible values include: 'Active', 'Disabled', 'Warned'. + * + * @return the billingProfileStatus value + */ + public BillingProfileStatus billingProfileStatus() { + return this.billingProfileStatus; + } + + /** + * Get reason for the specified billing profile status. + * + * @return the billingProfileStatusReasonCode value + */ + public Object billingProfileStatusReasonCode() { + return this.billingProfileStatusReasonCode; + } + + /** + * Get the billing profile spending limit. + * + * @return the billingProfileSpendingLimit value + */ + public Object billingProfileSpendingLimit() { + return this.billingProfileSpendingLimit; + } + + /** + * Get the cost center applied to the subscription. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Get the ID of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the name of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionDisplayName value + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the product ID of the Azure plan. + * + * @return the productId value + */ + public String productId() { + return this.productId; + } + + /** + * Get the product name of the Azure plan. + * + * @return the productName value + */ + public String productName() { + return this.productName; + } + + /** + * Get the sku ID of the Azure plan for the subscription. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Get the sku description of the Azure plan for the subscription. + * + * @return the skuDescription value + */ + public String skuDescription() { + return this.skuDescription; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertysImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertysImpl.java new file mode 100644 index 0000000000000..e3b5c9149fe74 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertysImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPropertys; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProperty; + +class BillingPropertysImpl extends WrapperImpl implements BillingPropertys { + private final BillingManager manager; + + BillingPropertysImpl(BillingManager manager) { + super(manager.inner().billingPropertys()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getAsync() { + BillingPropertysInner client = this.inner(); + return client.getAsync() + .map(new Func1() { + @Override + public BillingProperty call(BillingPropertyInner inner) { + return new BillingPropertyImpl(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/BillingPropertysInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertysInner.java new file mode 100644 index 0000000000000..b37758a90ff3f --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingPropertysInner.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingPropertys. + */ +public class BillingPropertysInner { + /** The Retrofit service to perform REST calls. */ + private BillingPropertysService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingPropertysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingPropertysInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingPropertysService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingPropertys to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingPropertysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPropertys get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default") + Observable> get(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + * + * @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 BillingPropertyInner object if successful. + */ + public BillingPropertyInner get() { + return getWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPropertyInner object + */ + public Observable getAsync() { + return getWithServiceResponseAsync().map(new Func1, BillingPropertyInner>() { + @Override + public BillingPropertyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with agreement type Enterprise Agreement. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPropertyInner object + */ + public Observable> getWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} 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/BillingRoleAssignmentImpl.java new file mode 100644 index 0000000000000..7f7de87ef61a3 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentImpl.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignment; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; + +class BillingRoleAssignmentImpl extends IndexableRefreshableWrapperImpl implements BillingRoleAssignment { + private final BillingManager manager; + private String billingAccountName; + private String billingRoleAssignmentName; + + BillingRoleAssignmentImpl(BillingRoleAssignmentInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.billingRoleAssignmentName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingRoleAssignments"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + BillingRoleAssignmentsInner client = this.manager().inner().billingRoleAssignments(); + return client.getByBillingAccountAsync(this.billingAccountName, this.billingRoleAssignmentName); + } + + + + @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 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 roleDefinitionName() { + return this.inner().roleDefinitionName(); + } + + @Override + public String scope() { + return this.inner().scope(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} 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 new file mode 100644 index 0000000000000..a3b1420ee8d57 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentInner.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The role assignment. + */ +@JsonFlatten +public class BillingRoleAssignmentInner extends ProxyResource { + /** + * The date the role assignment was created. + */ + @JsonProperty(value = "properties.createdOn", access = JsonProperty.Access.WRITE_ONLY) + private String createdOn; + + /** + * The tenant Id of the user who created the role assignment. + */ + @JsonProperty(value = "properties.createdByPrincipalTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String createdByPrincipalTenantId; + + /** + * The principal Id of the user who created the role assignment. + */ + @JsonProperty(value = "properties.createdByPrincipalId", access = JsonProperty.Access.WRITE_ONLY) + private String createdByPrincipalId; + + /** + * The name of the role assignment. + */ + @JsonProperty(value = "properties.name", access = JsonProperty.Access.WRITE_ONLY) + private String billingRoleAssignmentName; + + /** + * The principal id of the user to whom the role was assigned. + */ + @JsonProperty(value = "properties.principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The ID of the role definition. + */ + @JsonProperty(value = "properties.roleDefinitionName", access = JsonProperty.Access.WRITE_ONLY) + private String roleDefinitionName; + + /** + * The scope at which the role was assigned. + */ + @JsonProperty(value = "properties.scope", access = JsonProperty.Access.WRITE_ONLY) + private String scope; + + /** + * Get the date the role assignment was created. + * + * @return the createdOn value + */ + public String createdOn() { + return this.createdOn; + } + + /** + * Get the tenant Id of the user who created the role assignment. + * + * @return the createdByPrincipalTenantId value + */ + public String createdByPrincipalTenantId() { + return this.createdByPrincipalTenantId; + } + + /** + * Get the principal Id of the user who created the role assignment. + * + * @return the createdByPrincipalId value + */ + public String createdByPrincipalId() { + return this.createdByPrincipalId; + } + + /** + * Get the name of the role assignment. + * + * @return the billingRoleAssignmentName value + */ + public String billingRoleAssignmentName() { + return this.billingRoleAssignmentName; + } + + /** + * Get the principal id of the user to whom the role was assigned. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the ID of the role definition. + * + * @return the roleDefinitionName value + */ + public String roleDefinitionName() { + return this.roleDefinitionName; + } + + /** + * Get the scope at which the role was assigned. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentListResultImpl.java new file mode 100644 index 0000000000000..806ffab7a9b85 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentListResultImpl.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignmentListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class BillingRoleAssignmentListResultImpl extends WrapperImpl implements BillingRoleAssignmentListResult { + private final BillingManager manager; + BillingRoleAssignmentListResultImpl(BillingRoleAssignmentListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + 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/BillingRoleAssignmentListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentListResultInner.java new file mode 100644 index 0000000000000..5d597259a37ee --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentListResultInner.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 list of role assignments. + */ +public class BillingRoleAssignmentListResultInner { + /** + * The list of role assignments. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the list of role assignments. + * + * @return the value 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/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 new file mode 100644 index 0000000000000..91fddda04a0d3 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsImpl.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.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments; +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.management.billing.v2019_10_01_preview.BillingRoleAssignmentListResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignmentPayload; + +class BillingRoleAssignmentsImpl extends WrapperImpl implements BillingRoleAssignments { + private final BillingManager manager; + + BillingRoleAssignmentsImpl(BillingManager manager) { + super(manager.inner().billingRoleAssignments()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private BillingRoleAssignmentImpl wrapModel(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + + @Override + 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() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + 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() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(String billingAccountName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByBillingAccountAsync(billingAccountName, billingRoleAssignmentName) + .flatMap(new Func1>() { + @Override + public Observable call(BillingRoleAssignmentInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((BillingRoleAssignment)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).toCompletable(); + } + + @Override + public Observable addByBillingAccountAsync(String billingAccountName, BillingRoleAssignmentPayload parameters) { + BillingRoleAssignmentsInner client = this.inner(); + return client.addByBillingAccountAsync(billingAccountName, parameters) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable addByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentPayload parameters) { + BillingRoleAssignmentsInner client = this.inner(); + return client.addByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable addByBillingProfileAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters) { + BillingRoleAssignmentsInner client = this.inner(); + return client.addByBillingProfileAsync(billingAccountName, billingProfileName, parameters) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(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/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 new file mode 100644 index 0000000000000..f44fcc7c9786f --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleAssignmentsInner.java @@ -0,0 +1,1171 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingRoleAssignmentPayload; +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.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingRoleAssignments. + */ +public class BillingRoleAssignmentsInner { + /** The Retrofit service to perform REST calls. */ + private BillingRoleAssignmentsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingRoleAssignmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingRoleAssignmentsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingRoleAssignmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingRoleAssignments to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingRoleAssignmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments getByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByBillingAccount(@Path("billingAccountName") String billingAccountName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments deleteByBillingAccount" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByBillingAccount(@Path("billingAccountName") String billingAccountName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments getByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments deleteByInvoiceSection" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments getByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByBillingProfile(@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 deleteByBillingProfile" }) + @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 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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments addByBillingAccount" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/createBillingRoleAssignment") + Observable> addByBillingAccount(@Path("billingAccountName") String billingAccountName, @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 listByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleAssignments") + Observable> listByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleAssignments addByInvoiceSection" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/createBillingRoleAssignment") + Observable> addByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @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 listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments") + 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.BillingRoleAssignments addByBillingProfile" }) + @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); + + } + + /** + * 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. + * + * @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 + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByBillingAccount(String billingAccountName, String billingRoleAssignmentName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing 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 getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName), serviceCallback); + } + + /** + * 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. + * + * @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 to the BillingRoleAssignmentInner object + */ + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * + * @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 to the BillingRoleAssignmentInner object + */ + public Observable> getByBillingAccountWithServiceResponseAsync(String billingAccountName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingAccount(billingAccountName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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. + * + * @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 + * @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 deleteByBillingAccount(String billingAccountName, String billingRoleAssignmentName) { + return deleteByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing 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 deleteByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName), serviceCallback); + } + + /** + * 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. + * + * @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 to the BillingRoleAssignmentInner object + */ + public Observable deleteByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + return deleteByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * + * @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 to the BillingRoleAssignmentInner object + */ + public Observable> deleteByBillingAccountWithServiceResponseAsync(String billingAccountName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteByBillingAccount(billingAccountName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByBillingAccountDelegate(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 a role assignment 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 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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + return getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Gets a role assignment 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 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 getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Gets a role assignment 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 billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + return getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a role assignment 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 billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> getByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, 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 (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.getByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByInvoiceSectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByInvoiceSectionDelegate(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); + } + + /** + * Deletes a role assignment 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 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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner deleteByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + return deleteByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Deletes a role assignment 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 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 deleteByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Deletes a role assignment 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 billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable deleteByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleAssignmentName) { + return deleteByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a role assignment 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 billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> deleteByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, 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 (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.deleteByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByInvoiceSectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByInvoiceSectionDelegate(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 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByBillingProfile(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName), serviceCallback); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> getByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingProfile(billingAccountName, billingProfileName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner deleteByBillingProfile(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return deleteByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 deleteByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName), serviceCallback); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable deleteByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return deleteByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> deleteByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteByBillingProfile(billingAccountName, billingProfileName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByBillingProfileDelegate(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 account. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer 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 BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner listByBillingAccount(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).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. + * + * @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(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName), 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable listByBillingAccountAsync(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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 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 addByBillingAccount(String billingAccountName, BillingRoleAssignmentPayload parameters) { + return addByBillingAccountWithServiceResponseAsync(billingAccountName, parameters).toBlocking().single().body(); + } + + /** + * 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 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 addByBillingAccountAsync(String billingAccountName, BillingRoleAssignmentPayload parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addByBillingAccountWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * 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 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 addByBillingAccountAsync(String billingAccountName, BillingRoleAssignmentPayload parameters) { + return addByBillingAccountWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @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> 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 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."); + } + 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>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addByInvoiceSectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + 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); + } + +} 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 new file mode 100644 index 0000000000000..78aac771a0e10 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionImpl.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingRoleDefinition; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingPermissionsProperties; + +class BillingRoleDefinitionImpl extends IndexableRefreshableWrapperImpl implements BillingRoleDefinition { + private final BillingManager manager; + private String billingAccountName; + private String billingRoleDefinitionName; + + BillingRoleDefinitionImpl(BillingRoleDefinitionInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.billingRoleDefinitionName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingRoleDefinitions"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + BillingRoleDefinitionsInner client = this.manager().inner().billingRoleDefinitions(); + return client.getByBillingAccountAsync(this.billingAccountName, this.billingRoleDefinitionName); + } + + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List permissions() { + return this.inner().permissions(); + } + + @Override + public String roleName() { + return this.inner().roleName(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} 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 new file mode 100644 index 0000000000000..f705030001214 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionInner.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.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; + +/** + * The properties of a role definition. + */ +@JsonFlatten +public class BillingRoleDefinitionInner extends ProxyResource { + /** + * The role description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * The billingPermissions the role has. + */ + @JsonProperty(value = "properties.permissions") + private List permissions; + + /** + * The name of the role. + */ + @JsonProperty(value = "properties.roleName", access = JsonProperty.Access.WRITE_ONLY) + private String roleName; + + /** + * Get the role description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get the billingPermissions the role has. + * + * @return the permissions value + */ + public List permissions() { + return this.permissions; + } + + /** + * Set the billingPermissions the role has. + * + * @param permissions the permissions value to set + * @return the BillingRoleDefinitionInner object itself. + */ + public BillingRoleDefinitionInner withPermissions(List permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the name of the role. + * + * @return the roleName value + */ + public String roleName() { + return this.roleName; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionListResultImpl.java new file mode 100644 index 0000000000000..4dcc931b939e4 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionListResultImpl.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitionListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class BillingRoleDefinitionListResultImpl extends WrapperImpl implements BillingRoleDefinitionListResult { + private final BillingManager manager; + BillingRoleDefinitionListResultImpl(BillingRoleDefinitionListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + 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/BillingRoleDefinitionListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionListResultInner.java new file mode 100644 index 0000000000000..087fc5f964453 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionListResultInner.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 list of role definitions. + */ +public class BillingRoleDefinitionListResultInner { + /** + * The role definitions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the role definitions. + * + * @return the value 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/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 new file mode 100644 index 0000000000000..b7552b30c02f6 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsImpl.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingRoleDefinitions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinition; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitionListResult; + +class BillingRoleDefinitionsImpl extends WrapperImpl implements BillingRoleDefinitions { + private final BillingManager manager; + + BillingRoleDefinitionsImpl(BillingManager manager) { + super(manager.inner().billingRoleDefinitions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private BillingRoleDefinitionImpl wrapModel(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + + @Override + public Observable getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleDefinitionName) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(String billingAccountName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingRoleDefinitionListResult call(BillingRoleDefinitionListResultInner inner) { + return new BillingRoleDefinitionListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingRoleDefinitionListResult call(BillingRoleDefinitionListResultInner inner) { + return new BillingRoleDefinitionListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingRoleDefinitionListResult call(BillingRoleDefinitionListResultInner inner) { + return new BillingRoleDefinitionListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByBillingAccountAsync(billingAccountName, billingRoleDefinitionName) + .flatMap(new Func1>() { + @Override + public Observable call(BillingRoleDefinitionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((BillingRoleDefinition)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/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 new file mode 100644 index 0000000000000..5a6d399156c4e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingRoleDefinitionsInner.java @@ -0,0 +1,599 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingRoleDefinitions. + */ +public class BillingRoleDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private BillingRoleDefinitionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingRoleDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingRoleDefinitionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingRoleDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingRoleDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingRoleDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitions getByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByBillingAccount(@Path("billingAccountName") String billingAccountName, @Path("billingRoleDefinitionName") String billingRoleDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitions getByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleDefinitionName") String billingRoleDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitions getByBillingProfile" }) + @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 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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitions listByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions") + Observable> listByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingRoleDefinitions listByBillingProfile" }) + @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); + + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing 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 getByBillingAccount(String billingAccountName, String billingRoleDefinitionName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing 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 getByBillingAccountAsync(String billingAccountName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName), serviceCallback); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing 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 getByBillingAccountAsync(String billingAccountName, String billingRoleDefinitionName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * + * @param billingAccountName The ID that uniquely identifies a billing 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> getByBillingAccountWithServiceResponseAsync(String billingAccountName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingAccount(billingAccountName, billingRoleDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only 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 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 getByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName) { + return getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only 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 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 getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only 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 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 getByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName) { + return getByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only 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 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> getByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByInvoiceSectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByInvoiceSectionDelegate(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 a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 getByBillingProfile(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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 getByBillingProfileAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @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> getByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingProfile(billingAccountName, billingProfileName, billingRoleDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * 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. + * + * @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 BillingRoleDefinitionListResultInner object if successful. + */ + public BillingRoleDefinitionListResultInner listByBillingAccount(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).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. + * + * @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(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName), 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable listByBillingAccountAsync(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, BillingRoleDefinitionListResultInner>() { + @Override + public BillingRoleDefinitionListResultInner 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. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 BillingRoleDefinitionListResultInner object if successful. + */ + public BillingRoleDefinitionListResultInner listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * 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. + * + * @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 definitions for an invoice section. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 BillingRoleDefinitionListResultInner object + */ + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, BillingRoleDefinitionListResultInner>() { + @Override + public BillingRoleDefinitionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * + * @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 BillingRoleDefinitionListResultInner 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); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 BillingRoleDefinitionListResultInner object if successful. + */ + public BillingRoleDefinitionListResultInner listByBillingProfile(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 BillingRoleDefinitionListResultInner object + */ + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingRoleDefinitionListResultInner>() { + @Override + public BillingRoleDefinitionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 BillingRoleDefinitionListResultInner object + */ + public Observable> listByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionImpl.java new file mode 100644 index 0000000000000..b4c6470444bf6 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionImpl.java @@ -0,0 +1,132 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingSubscription; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Amount; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Reseller; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscriptionStatusType; +import java.util.UUID; + +class BillingSubscriptionImpl extends IndexableRefreshableWrapperImpl implements BillingSubscription { + private final BillingManager manager; + private String billingAccountName; + private String customerName; + private String billingSubscriptionName; + + BillingSubscriptionImpl(BillingSubscriptionInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.customerName = IdParsingUtils.getValueFromIdByName(inner.id(), "customers"); + this.billingSubscriptionName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingSubscriptions"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + BillingSubscriptionsInner client = this.manager().inner().billingSubscriptions(); + return client.getByCustomerAsync(this.billingAccountName, this.customerName, this.billingSubscriptionName); + } + + + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String customerDisplayName() { + return this.inner().customerDisplayName(); + } + + @Override + public String customerId() { + return this.inner().customerId(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoiceSectionDisplayName() { + return this.inner().invoiceSectionDisplayName(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public Amount lastMonthCharges() { + return this.inner().lastMonthCharges(); + } + + @Override + public Amount monthToDateCharges() { + return this.inner().monthToDateCharges(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Reseller reseller() { + return this.inner().reseller(); + } + + @Override + public String skuDescription() { + return this.inner().skuDescription(); + } + + @Override + public String skuId() { + return this.inner().skuId(); + } + + @Override + public BillingSubscriptionStatusType subscriptionBillingStatus() { + return this.inner().subscriptionBillingStatus(); + } + + @Override + public UUID subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionInner.java new file mode 100644 index 0000000000000..00a5096fa6687 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionInner.java @@ -0,0 +1,260 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.UUID; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscriptionStatusType; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Amount; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Reseller; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing subscription. + */ +@JsonFlatten +public class BillingSubscriptionInner extends ProxyResource { + /** + * The name of the subscription. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The ID of the subscription. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private UUID subscriptionId; + + /** + * The current billing status of the subscription. Possible values include: + * 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning'. + */ + @JsonProperty(value = "properties.subscriptionBillingStatus") + private BillingSubscriptionStatusType subscriptionBillingStatus; + + /** + * The last month charges. + */ + @JsonProperty(value = "properties.lastMonthCharges", access = JsonProperty.Access.WRITE_ONLY) + private Amount lastMonthCharges; + + /** + * The current month to date charges. + */ + @JsonProperty(value = "properties.monthToDateCharges", access = JsonProperty.Access.WRITE_ONLY) + private Amount monthToDateCharges; + + /** + * The ID of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * The ID of the customer for whom the subscription was created. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * The name of the customer for whom the subscription was created. The + * field is applicable only for Microsoft Partner Agreement billing + * account. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + + /** + * The ID of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * The name of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /** + * Reseller for this subscription. + */ + @JsonProperty(value = "properties.reseller", access = JsonProperty.Access.WRITE_ONLY) + private Reseller reseller; + + /** + * The sku ID of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuId") + private String skuId; + + /** + * The sku description of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * Get the name of the subscription. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the ID of the subscription. + * + * @return the subscriptionId value + */ + public UUID subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the current billing status of the subscription. Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning'. + * + * @return the subscriptionBillingStatus value + */ + public BillingSubscriptionStatusType subscriptionBillingStatus() { + return this.subscriptionBillingStatus; + } + + /** + * Set the current billing status of the subscription. Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning'. + * + * @param subscriptionBillingStatus the subscriptionBillingStatus value to set + * @return the BillingSubscriptionInner object itself. + */ + public BillingSubscriptionInner withSubscriptionBillingStatus(BillingSubscriptionStatusType subscriptionBillingStatus) { + this.subscriptionBillingStatus = subscriptionBillingStatus; + return this; + } + + /** + * Get the last month charges. + * + * @return the lastMonthCharges value + */ + public Amount lastMonthCharges() { + return this.lastMonthCharges; + } + + /** + * Get the current month to date charges. + * + * @return the monthToDateCharges value + */ + public Amount monthToDateCharges() { + return this.monthToDateCharges; + } + + /** + * Get the ID of the billing profile to which the subscription is billed. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile to which the subscription is billed. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the ID of the customer for whom the subscription was created. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the name of the customer for whom the subscription was created. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + + /** + * Get the ID of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the name of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionDisplayName value + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get reseller for this subscription. + * + * @return the reseller value + */ + public Reseller reseller() { + return this.reseller; + } + + /** + * Get the sku ID of the Azure plan for the subscription. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Set the sku ID of the Azure plan for the subscription. + * + * @param skuId the skuId value to set + * @return the BillingSubscriptionInner object itself. + */ + public BillingSubscriptionInner withSkuId(String skuId) { + this.skuId = skuId; + return this; + } + + /** + * Get the sku description of the Azure plan for the subscription. + * + * @return the skuDescription value + */ + public String skuDescription() { + return this.skuDescription; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsImpl.java new file mode 100644 index 0000000000000..0c862bbe3de28 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsImpl.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingSubscriptions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscription; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscriptionsListResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransferBillingSubscriptionResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ValidateSubscriptionTransferEligibilityResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransferBillingSubscriptionRequestProperties; + +class BillingSubscriptionsImpl extends WrapperImpl implements BillingSubscriptions { + private final BillingManager manager; + + BillingSubscriptionsImpl(BillingManager manager) { + super(manager.inner().billingSubscriptions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private BillingSubscriptionImpl wrapModel(BillingSubscriptionInner inner) { + return new BillingSubscriptionImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + BillingSubscriptionsInner 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 BillingSubscription call(BillingSubscriptionInner inner) { + return new BillingSubscriptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingSubscriptionsListResult call(BillingSubscriptionsListResultInner inner) { + return new BillingSubscriptionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingSubscriptionsListResult call(BillingSubscriptionsListResultInner inner) { + return new BillingSubscriptionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName) { + BillingSubscriptionsInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName) + .map(new Func1() { + @Override + public BillingSubscription call(BillingSubscriptionInner inner) { + return new BillingSubscriptionImpl(inner, manager()); + } + }); + } + + @Override + public Observable transferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + BillingSubscriptionsInner client = this.inner(); + return client.transferAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters) + .map(new Func1() { + @Override + public TransferBillingSubscriptionResult call(TransferBillingSubscriptionResultInner inner) { + return new TransferBillingSubscriptionResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable validateTransferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + BillingSubscriptionsInner client = this.inner(); + return client.validateTransferAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters) + .map(new Func1() { + @Override + public ValidateSubscriptionTransferEligibilityResult call(ValidateSubscriptionTransferEligibilityResultInner inner) { + return new ValidateSubscriptionTransferEligibilityResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByCustomerAsync(final String billingAccountName, final String customerName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByCustomerAsync(billingAccountName, customerName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscription call(BillingSubscriptionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getByCustomerAsync(String billingAccountName, String customerName, String billingSubscriptionName) { + BillingSubscriptionsInner client = this.inner(); + return client.getByCustomerAsync(billingAccountName, customerName, billingSubscriptionName) + .flatMap(new Func1>() { + @Override + public Observable call(BillingSubscriptionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((BillingSubscription)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/BillingSubscriptionsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsInner.java new file mode 100644 index 0000000000000..877fed7924595 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsInner.java @@ -0,0 +1,1216 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscriptionsTransferHeaders; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransferBillingSubscriptionRequestProperties; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingSubscriptions. + */ +public class BillingSubscriptionsInner { + /** The Retrofit service to perform REST calls. */ + private BillingSubscriptionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingSubscriptionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingSubscriptionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingSubscriptionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingSubscriptions to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingSubscriptionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscriptions listByCustomer" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions") + Observable> listByCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscriptions getByCustomer" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions/{billingSubscriptionName}") + Observable> getByCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Path("billingSubscriptionName") String billingSubscriptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscriptions listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscriptions listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions") + 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.BillingSubscriptions listByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions") + Observable> listByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscriptions get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingSubscriptionName") String billingSubscriptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.BillingSubscriptions transfer" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer") + Observable> transfer(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingSubscriptionName") String billingSubscriptionName, @Body TransferBillingSubscriptionRequestProperties 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.BillingSubscriptions beginTransfer" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer") + Observable> beginTransfer(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingSubscriptionName") String billingSubscriptionName, @Body TransferBillingSubscriptionRequestProperties 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.BillingSubscriptions validateTransfer" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/validateTransferEligibility") + Observable> validateTransfer(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingSubscriptionName") String billingSubscriptionName, @Body TransferBillingSubscriptionRequestProperties 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.BillingSubscriptions listByCustomerNext" }) + @GET + Observable> listByCustomerNext(@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.BillingSubscriptions listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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<BillingSubscriptionInner> object if successful. + */ + public PagedList listByCustomer(final String billingAccountName, final String customerName) { + ServiceResponse> response = listByCustomerSinglePageAsync(billingAccountName, customerName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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> listByCustomerAsync(final String billingAccountName, final String customerName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerSinglePageAsync(billingAccountName, customerName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable> listByCustomerAsync(final String billingAccountName, final String customerName) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionInner> object + */ + public Observable>> listByCustomerWithServiceResponseAsync(final String billingAccountName, final String customerName) { + return listByCustomerSinglePageAsync(billingAccountName, customerName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerSinglePageAsync(final String billingAccountName, final String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByCustomer(billingAccountName, customerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a subscription by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @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 BillingSubscriptionInner object if successful. + */ + public BillingSubscriptionInner getByCustomer(String billingAccountName, String customerName, String billingSubscriptionName) { + return getByCustomerWithServiceResponseAsync(billingAccountName, customerName, billingSubscriptionName).toBlocking().single().body(); + } + + /** + * Gets a subscription by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @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 getByCustomerAsync(String billingAccountName, String customerName, String billingSubscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByCustomerWithServiceResponseAsync(billingAccountName, customerName, billingSubscriptionName), serviceCallback); + } + + /** + * Gets a subscription by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionInner object + */ + public Observable getByCustomerAsync(String billingAccountName, String customerName, String billingSubscriptionName) { + return getByCustomerWithServiceResponseAsync(billingAccountName, customerName, billingSubscriptionName).map(new Func1, BillingSubscriptionInner>() { + @Override + public BillingSubscriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a subscription by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionInner object + */ + public Observable> getByCustomerWithServiceResponseAsync(String billingAccountName, String customerName, String billingSubscriptionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByCustomer(billingAccountName, customerName, billingSubscriptionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByCustomerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByCustomerDelegate(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 subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<BillingSubscriptionInner> 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 subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<BillingSubscriptionInner> 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 subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<BillingSubscriptionInner> 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 subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionInner> 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); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 BillingSubscriptionsListResultInner object if successful. + */ + public BillingSubscriptionsListResultInner listByBillingProfile(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 BillingSubscriptionsListResultInner object + */ + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingSubscriptionsListResultInner>() { + @Override + public BillingSubscriptionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 BillingSubscriptionsListResultInner 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); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only 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 BillingSubscriptionsListResultInner object if successful. + */ + public BillingSubscriptionsListResultInner listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only 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 subscriptions that are billed to an invoice section. The operation is supported only 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 BillingSubscriptionsListResultInner object + */ + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, BillingSubscriptionsListResultInner>() { + @Override + public BillingSubscriptionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only 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 BillingSubscriptionsListResultInner 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); + } + + /** + * Gets a subscription by its ID. The operation is supported only 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @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 BillingSubscriptionInner object if successful. + */ + public BillingSubscriptionInner get(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName).toBlocking().single().body(); + } + + /** + * Gets a subscription by its ID. The operation is supported only 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName), serviceCallback); + } + + /** + * Gets a subscription by its ID. The operation is supported only 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName).map(new Func1, BillingSubscriptionInner>() { + @Override + public BillingSubscriptionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a subscription by its ID. The operation is supported only 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName) { + 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 (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the transfer product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TransferBillingSubscriptionResultInner object if successful. + */ + public TransferBillingSubscriptionResultInner transfer(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return transferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).toBlocking().last().body(); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the transfer product operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture transferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(transferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters), serviceCallback); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the transfer product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable transferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return transferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).map(new Func1, TransferBillingSubscriptionResultInner>() { + @Override + public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the transfer product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> transferWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties 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 (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.transfer(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingSubscriptionsTransferHeaders.class); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the transfer product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TransferBillingSubscriptionResultInner object if successful. + */ + public TransferBillingSubscriptionResultInner beginTransfer(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return beginTransferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).toBlocking().single().body(); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the transfer product operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginTransferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginTransferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters), serviceCallback); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the transfer product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferBillingSubscriptionResultInner object + */ + public Observable beginTransferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return beginTransferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).map(new Func1, TransferBillingSubscriptionResultInner>() { + @Override + public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the transfer product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferBillingSubscriptionResultInner object + */ + public Observable> beginTransferWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties 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 (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginTransfer(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginTransferDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginTransferDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, BillingSubscriptionsTransferHeaders.class); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the validate transfer eligibility 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 ValidateSubscriptionTransferEligibilityResultInner object if successful. + */ + public ValidateSubscriptionTransferEligibilityResultInner validateTransfer(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return validateTransferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).toBlocking().single().body(); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the validate transfer eligibility 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 validateTransferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateTransferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters), serviceCallback); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the validate transfer eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateSubscriptionTransferEligibilityResultInner object + */ + public Observable validateTransferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return validateTransferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters).map(new Func1, ValidateSubscriptionTransferEligibilityResultInner>() { + @Override + public ValidateSubscriptionTransferEligibilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 billingSubscriptionName The ID that uniquely identifies a subscription. + * @param parameters Request parameters that are provided to the validate transfer eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateSubscriptionTransferEligibilityResultInner object + */ + public Observable> validateTransferWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties 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 (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.validateTransfer(billingAccountName, billingProfileName, invoiceSectionName, billingSubscriptionName, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateTransferDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateTransferDelegate(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 subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<BillingSubscriptionInner> object if successful. + */ + public PagedList listByCustomerNext(final String nextPageLink) { + ServiceResponse> response = listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner 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> listByCustomerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<BillingSubscriptionInner> object + */ + public Observable> listByCustomerNextAsync(final String nextPageLink) { + return listByCustomerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<BillingSubscriptionInner> object + */ + public Observable>> listByCustomerNextWithServiceResponseAsync(final String nextPageLink) { + return listByCustomerNextSinglePageAsync(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(listByCustomerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<BillingSubscriptionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNextSinglePageAsync(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.listByCustomerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerNextDelegate(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 subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<BillingSubscriptionInner> 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 subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<BillingSubscriptionInner> 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 subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<BillingSubscriptionInner> 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 subscriptions for a billing account. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<BillingSubscriptionInner> 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); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsListResultImpl.java new file mode 100644 index 0000000000000..0a5c81fe0ccdc --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsListResultImpl.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.BillingSubscriptionsListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class BillingSubscriptionsListResultImpl extends WrapperImpl implements BillingSubscriptionsListResult { + private final BillingManager manager; + BillingSubscriptionsListResultImpl(BillingSubscriptionsListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsListResultInner.java new file mode 100644 index 0000000000000..880a4b6fda914 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/BillingSubscriptionsListResultInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of billing subscriptions. + */ +public class BillingSubscriptionsListResultInner { + /** + * The list of billing subscriptions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of billing subscriptions. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerBillingProfileBillingAccountTransferDetailsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerBillingProfileBillingAccountTransferDetailsImpl.java new file mode 100644 index 0000000000000..6e2a3e3632895 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerBillingProfileBillingAccountTransferDetailsImpl.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.CustomerBillingProfileBillingAccountTransferDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.DetailedTransferStatus; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransferStatus; + +class CustomerBillingProfileBillingAccountTransferDetailsImpl extends WrapperImpl implements CustomerBillingProfileBillingAccountTransferDetails { + private final BillingManager manager; + private String billingAccountName; + private String billingProfileName; + private String customerName; + private String transferName; + + CustomerBillingProfileBillingAccountTransferDetailsImpl(TransferDetailsInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public String billingAccountId() { + return this.inner().billingAccountId(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String canceledBy() { + return this.inner().canceledBy(); + } + + @Override + public DateTime creationTime() { + return this.inner().creationTime(); + } + + @Override + public List detailedTransferStatus() { + return this.inner().detailedTransferStatus(); + } + + @Override + public DateTime expirationTime() { + return this.inner().expirationTime(); + } + + @Override + public String initiatorCustomerType() { + return this.inner().initiatorCustomerType(); + } + + @Override + public String initiatorEmailId() { + return this.inner().initiatorEmailId(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public DateTime lastModifiedTime() { + return this.inner().lastModifiedTime(); + } + + @Override + public String recipientEmailId() { + return this.inner().recipientEmailId(); + } + + @Override + public String resellerId() { + return this.inner().resellerId(); + } + + @Override + public String resellerName() { + return this.inner().resellerName(); + } + + @Override + public TransferStatus transferStatus() { + return this.inner().transferStatus(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerImpl.java new file mode 100644 index 0000000000000..dc3a4e36889b7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerImpl.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.Customer; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AzurePlan; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Reseller; + +class CustomerImpl extends WrapperImpl implements Customer { + private final BillingManager manager; + + CustomerImpl(CustomerInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List enabledAzurePlans() { + return this.inner().enabledAzurePlans(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List resellers() { + return this.inner().resellers(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerInner.java new file mode 100644 index 0000000000000..bc0634644f7fb --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerInner.java @@ -0,0 +1,102 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.microsoft.azure.management.billing.v2019_10_01_preview.AzurePlan; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Reseller; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A partner's customer. + */ +@JsonFlatten +public class CustomerInner extends ProxyResource { + /** + * The name of the customer. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Azure plans enabled for the customer. + */ + @JsonProperty(value = "properties.enabledAzurePlans") + private List enabledAzurePlans; + + /** + * The list of resellers for which an Azure plan is enabled for the + * customer. + */ + @JsonProperty(value = "properties.resellers") + private List resellers; + + /** + * Get the name of the customer. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the customer. + * + * @param displayName the displayName value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get azure plans enabled for the customer. + * + * @return the enabledAzurePlans value + */ + public List enabledAzurePlans() { + return this.enabledAzurePlans; + } + + /** + * Set azure plans enabled for the customer. + * + * @param enabledAzurePlans the enabledAzurePlans value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withEnabledAzurePlans(List enabledAzurePlans) { + this.enabledAzurePlans = enabledAzurePlans; + return this; + } + + /** + * Get the list of resellers for which an Azure plan is enabled for the customer. + * + * @return the resellers value + */ + public List resellers() { + return this.resellers; + } + + /** + * Set the list of resellers for which an Azure plan is enabled for the customer. + * + * @param resellers the resellers value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withResellers(List resellers) { + this.resellers = resellers; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerPolicyImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerPolicyImpl.java new file mode 100644 index 0000000000000..5687a3187422e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerPolicyImpl.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.CustomerPolicy; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ViewCharges; + +class CustomerPolicyImpl extends WrapperImpl implements CustomerPolicy { + private final BillingManager manager; + CustomerPolicyImpl(CustomerPolicyInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ViewCharges viewCharges() { + return this.inner().viewCharges(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerPolicyInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerPolicyInner.java new file mode 100644 index 0000000000000..5fa46bc4a0f96 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomerPolicyInner.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 com.microsoft.azure.management.billing.v2019_10_01_preview.ViewCharges; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The customer's Policy. + */ +@JsonFlatten +public class CustomerPolicyInner extends ProxyResource { + /** + * The policy that controls whether the users in customer's organization + * can view charges at pay-as-you-go prices. Possible values include: + * 'Allowed', 'NotAllowed'. + */ + @JsonProperty(value = "properties.viewCharges") + private ViewCharges viewCharges; + + /** + * Get the policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed'. + * + * @return the viewCharges value + */ + public ViewCharges viewCharges() { + return this.viewCharges; + } + + /** + * Set the policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed'. + * + * @param viewCharges the viewCharges value to set + * @return the CustomerPolicyInner object itself. + */ + public CustomerPolicyInner withViewCharges(ViewCharges viewCharges) { + this.viewCharges = viewCharges; + 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/CustomersImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomersImpl.java new file mode 100644 index 0000000000000..c6a3e3cba33b9 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomersImpl.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Customers; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Customer; + +class CustomersImpl extends WrapperImpl implements Customers { + private final BillingManager manager; + + CustomersImpl(BillingManager manager) { + super(manager.inner().customers()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private CustomerImpl wrapModel(CustomerInner inner) { + return new CustomerImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + CustomersInner 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 Customer call(CustomerInner inner) { + return new CustomerImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String customerName) { + CustomersInner client = this.inner(); + return client.getAsync(billingAccountName, customerName) + .map(new Func1() { + @Override + public Customer call(CustomerInner inner) { + return new CustomerImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + CustomersInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Customer call(CustomerInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomersInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomersInner.java new file mode 100644 index 0000000000000..4d0836f60faf7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/CustomersInner.java @@ -0,0 +1,942 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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; + +/** + * An instance of this class provides access to all the operations defined + * in Customers. + */ +public class CustomersInner { + /** The Retrofit service to perform REST calls. */ + private CustomersService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of CustomersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CustomersInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(CustomersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Customers to be + * used by Retrofit to perform actually REST calls. + */ + interface CustomersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Customers listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Customers listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Customers get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Customers listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@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.Customers listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner 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 PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner 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(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner 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 PagedList<CustomerInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner 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 PagedList<CustomerInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner 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 PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final String skiptoken = null; + return service.listByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), filter, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter the list of customers. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName, final String filter, final String skiptoken) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter the list of customers. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String filter, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter the list of customers. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String filter, final String skiptoken) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, filter, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter the list of customers. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String filter, final String skiptoken) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter, skiptoken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param filter May be used to filter the list of customers. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName, final String filter, final String skiptoken) { + 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(), filter, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<CustomerInner> 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 customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner 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 customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<CustomerInner> 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 customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<CustomerInner> 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 customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> 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."); + } + final String filter = null; + final String skiptoken = null; + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), filter, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter the list of customers. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName, final String filter, final String skiptoken) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName, filter, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter the list of customers. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountAsync(final String billingAccountName, final String filter, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName, filter, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter the list of customers. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName, final String filter, final String skiptoken) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, filter, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter the list of customers. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName, final String filter, final String skiptoken) { + return listByBillingAccountSinglePageAsync(billingAccountName, filter, skiptoken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param filter May be used to filter the list of customers. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName, final String filter, final String skiptoken) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), filter, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = 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); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CustomerInner object if successful. + */ + public CustomerInner get(String billingAccountName, String customerName) { + return getWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable getAsync(String billingAccountName, String customerName) { + return getWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, CustomerInner>() { + @Override + public CustomerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.get(billingAccountName, customerName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CustomerInner object if successful. + */ + public CustomerInner get(String billingAccountName, String customerName, String expand) { + return getWithServiceResponseAsync(billingAccountName, customerName, expand).toBlocking().single().body(); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String customerName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, customerName, expand), serviceCallback); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable getAsync(String billingAccountName, String customerName, String expand) { + return getWithServiceResponseAsync(billingAccountName, customerName, expand).map(new Func1, CustomerInner>() { + @Override + public CustomerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String customerName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, customerName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<CustomerInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner 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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<CustomerInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<CustomerInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<CustomerInner> 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 customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner 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 customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<CustomerInner> 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 customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<CustomerInner> 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 customers that are billed to a billing account. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<CustomerInner> 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); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentImpl.java new file mode 100644 index 0000000000000..a9dd3611e52d9 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.Department; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.ArrayList; +import com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccount; +import java.util.List; + +class DepartmentImpl extends IndexableRefreshableWrapperImpl implements Department { + private final BillingManager manager; + private String billingAccountName; + private String departmentName; + + DepartmentImpl(DepartmentInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.departmentName = IdParsingUtils.getValueFromIdByName(inner.id(), "departments"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + DepartmentsInner client = this.manager().inner().departments(); + return client.getAsync(this.billingAccountName, this.departmentName); + } + + + + @Override + public String costCenter() { + return this.inner().costCenter(); + } + + @Override + public String departmentName() { + return this.inner().departmentName(); + } + + @Override + public List enrollmentAccounts() { + List lst = new ArrayList(); + if (this.inner().enrollmentAccounts() != null) { + for (EnrollmentAccountInner inner : this.inner().enrollmentAccounts()) { + lst.add( new EnrollmentAccountImpl(inner, manager())); + } + } + return lst; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentInner.java new file mode 100644 index 0000000000000..9be863758a515 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentInner.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A department. + */ +@JsonFlatten +public class DepartmentInner extends ProxyResource { + /** + * The name of the department. + */ + @JsonProperty(value = "properties.departmentName") + private String departmentName; + + /** + * The cost center associated with the department. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /** + * The status of the department. + */ + @JsonProperty(value = "properties.status") + private String status; + + /** + * Associated enrollment accounts. By default this is not populated, unless + * it's specified in $expand. + */ + @JsonProperty(value = "properties.enrollmentAccounts") + private List enrollmentAccounts; + + /** + * Get the name of the department. + * + * @return the departmentName value + */ + public String departmentName() { + return this.departmentName; + } + + /** + * Set the name of the department. + * + * @param departmentName the departmentName value to set + * @return the DepartmentInner object itself. + */ + public DepartmentInner withDepartmentName(String departmentName) { + this.departmentName = departmentName; + return this; + } + + /** + * Get the cost center associated with the department. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the cost center associated with the department. + * + * @param costCenter the costCenter value to set + * @return the DepartmentInner object itself. + */ + public DepartmentInner withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the status of the department. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the department. + * + * @param status the status value to set + * @return the DepartmentInner object itself. + */ + public DepartmentInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get associated enrollment accounts. By default this is not populated, unless it's specified in $expand. + * + * @return the enrollmentAccounts value + */ + public List enrollmentAccounts() { + return this.enrollmentAccounts; + } + + /** + * Set associated enrollment accounts. By default this is not populated, unless it's specified in $expand. + * + * @param enrollmentAccounts the enrollmentAccounts value to set + * @return the DepartmentInner object itself. + */ + public DepartmentInner withEnrollmentAccounts(List enrollmentAccounts) { + this.enrollmentAccounts = enrollmentAccounts; + 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/DepartmentListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentListResultImpl.java new file mode 100644 index 0000000000000..cc08417910180 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentListResultImpl.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.DepartmentListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class DepartmentListResultImpl extends WrapperImpl implements DepartmentListResult { + private final BillingManager manager; + DepartmentListResultImpl(DepartmentListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentListResultInner.java new file mode 100644 index 0000000000000..d82d316f2df93 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentListResultInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of departments. + */ +public class DepartmentListResultInner { + /** + * The list of departments. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of departments. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsImpl.java new file mode 100644 index 0000000000000..f3b3555356fee --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsImpl.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.Departments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.billing.v2019_10_01_preview.DepartmentListResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Department; + +class DepartmentsImpl extends WrapperImpl implements Departments { + private final BillingManager manager; + + DepartmentsImpl(BillingManager manager) { + super(manager.inner().departments()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private DepartmentImpl wrapModel(DepartmentInner inner) { + return new DepartmentImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountNameAsync(String billingAccountName) { + DepartmentsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public DepartmentListResult call(DepartmentListResultInner inner) { + return new DepartmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String departmentName) { + DepartmentsInner client = this.inner(); + return client.getAsync(billingAccountName, departmentName) + .flatMap(new Func1>() { + @Override + public Observable call(DepartmentInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Department)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/DepartmentsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsInner.java new file mode 100644 index 0000000000000..30fd66efab978 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DepartmentsInner.java @@ -0,0 +1,388 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Departments. + */ +public class DepartmentsInner { + /** The Retrofit service to perform REST calls. */ + private DepartmentsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of DepartmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DepartmentsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(DepartmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Departments to be + * used by Retrofit to perform actually REST calls. + */ + interface DepartmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Departments listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Departments get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("departmentName") String departmentName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the departments that a user has access to. The operation is supported only for billing accounts with agreement type 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 DepartmentListResultInner object if successful. + */ + public DepartmentListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists the departments that a user has access to. The operation is supported only for billing accounts with agreement type 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 listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Lists the departments that a user has access to. The operation is supported only for billing accounts with agreement type 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 DepartmentListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, DepartmentListResultInner>() { + @Override + public DepartmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the departments that a user has access to. The operation is supported only for billing accounts with agreement type 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 DepartmentListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + final String filter = null; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the departments that a user has access to. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the enrollment accounts. + * @param filter May be used to filter by department name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DepartmentListResultInner object if successful. + */ + public DepartmentListResultInner listByBillingAccountName(String billingAccountName, String expand, String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).toBlocking().single().body(); + } + + /** + * Lists the departments that a user has access to. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the enrollment accounts. + * @param filter May be used to filter by department name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, String expand, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter), serviceCallback); + } + + /** + * Lists the departments that a user has access to. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the enrollment accounts. + * @param filter May be used to filter by department name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DepartmentListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName, String expand, String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).map(new Func1, DepartmentListResultInner>() { + @Override + public DepartmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the departments that a user has access to. The operation is supported only for billing accounts with agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the enrollment accounts. + * @param filter May be used to filter by department name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DepartmentListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand, String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a department by ID. 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 DepartmentInner object if successful. + */ + public DepartmentInner get(String billingAccountName, String departmentName) { + return getWithServiceResponseAsync(billingAccountName, departmentName).toBlocking().single().body(); + } + + /** + * Gets a department by ID. 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 getAsync(String billingAccountName, String departmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, departmentName), serviceCallback); + } + + /** + * Gets a department by ID. 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 DepartmentInner object + */ + public Observable getAsync(String billingAccountName, String departmentName) { + return getWithServiceResponseAsync(billingAccountName, departmentName).map(new Func1, DepartmentInner>() { + @Override + public DepartmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a department by ID. 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 DepartmentInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, 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."); + } + final String expand = null; + final String filter = null; + return service.get(billingAccountName, departmentName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a department by ID. 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 expand May be used to expand the enrollment accounts. + * @param filter May be used to filter by department name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DepartmentInner object if successful. + */ + public DepartmentInner get(String billingAccountName, String departmentName, String expand, String filter) { + return getWithServiceResponseAsync(billingAccountName, departmentName, expand, filter).toBlocking().single().body(); + } + + /** + * Gets a department by ID. 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 expand May be used to expand the enrollment accounts. + * @param filter May be used to filter by department name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String departmentName, String expand, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, departmentName, expand, filter), serviceCallback); + } + + /** + * Gets a department by ID. 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 expand May be used to expand the enrollment accounts. + * @param filter May be used to filter by department name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DepartmentInner object + */ + public Observable getAsync(String billingAccountName, String departmentName, String expand, String filter) { + return getWithServiceResponseAsync(billingAccountName, departmentName, expand, filter).map(new Func1, DepartmentInner>() { + @Override + public DepartmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a department by ID. 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 expand May be used to expand the enrollment accounts. + * @param filter May be used to filter by department name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DepartmentInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String departmentName, String expand, String filter) { + 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.get(billingAccountName, departmentName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DownloadUrlImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DownloadUrlImpl.java new file mode 100644 index 0000000000000..0fac0e81f1565 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DownloadUrlImpl.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.DownloadUrl; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; + +class DownloadUrlImpl extends WrapperImpl implements DownloadUrl { + private final BillingManager manager; + DownloadUrlImpl(DownloadUrlInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public DateTime expiryTime() { + return this.inner().expiryTime(); + } + + @Override + public String url() { + return this.inner().url(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DownloadUrlInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DownloadUrlInner.java new file mode 100644 index 0000000000000..b02808b59f6da --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/DownloadUrlInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A secure URL that can be used to download a an entity until the URL expires. + */ +public class DownloadUrlInner { + /** + * The time in UTC when the download URL will expire. + */ + @JsonProperty(value = "expiryTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expiryTime; + + /** + * The URL to the PDF file. + */ + @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY) + private String url; + + /** + * Get the time in UTC when the download URL will expire. + * + * @return the expiryTime value + */ + public DateTime expiryTime() { + return this.expiryTime; + } + + /** + * Get the URL to the PDF file. + * + * @return the url value + */ + public String url() { + return this.url; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountImpl.java new file mode 100644 index 0000000000000..75e3ba45bc1b7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountImpl.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.EnrollmentAccount; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Department; +import org.joda.time.DateTime; + +class EnrollmentAccountImpl extends IndexableRefreshableWrapperImpl implements EnrollmentAccount { + private final BillingManager manager; + private String billingAccountName; + private String enrollmentAccountName; + + EnrollmentAccountImpl(EnrollmentAccountInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.enrollmentAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "enrollmentAccounts"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + EnrollmentAccountsInner client = this.manager().inner().enrollmentAccounts(); + return client.getByEnrollmentAccountIdAsync(this.billingAccountName, this.enrollmentAccountName); + } + + + + @Override + public String accountName() { + return this.inner().accountName(); + } + + @Override + public String accountOwner() { + return this.inner().accountOwner(); + } + + @Override + public String costCenter() { + return this.inner().costCenter(); + } + + @Override + public Department department() { + DepartmentInner inner = this.inner().department(); + if (inner != null) { + return new DepartmentImpl(inner, manager()); + } else { + return null; + } + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime startDate() { + return this.inner().startDate(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountInner.java new file mode 100644 index 0000000000000..0e09c466c1556 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountInner.java @@ -0,0 +1,204 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An enrollment account. + */ +@JsonFlatten +public class EnrollmentAccountInner extends ProxyResource { + /** + * The name of the enrollment account. + */ + @JsonProperty(value = "properties.accountName") + private String accountName; + + /** + * The cost center associated with the enrollment account. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /** + * The owner of the enrollment account. + */ + @JsonProperty(value = "properties.accountOwner") + private String accountOwner; + + /** + * The status of the enrollment account. + */ + @JsonProperty(value = "properties.status") + private String status; + + /** + * The start date of the enrollment account. + */ + @JsonProperty(value = "properties.startDate") + private DateTime startDate; + + /** + * The end date of the enrollment account. + */ + @JsonProperty(value = "properties.endDate") + private DateTime endDate; + + /** + * Associated department. By default this is not populated, unless it's + * specified in $expand. + */ + @JsonProperty(value = "properties.department") + private DepartmentInner department; + + /** + * Get the name of the enrollment account. + * + * @return the accountName value + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the name of the enrollment account. + * + * @param accountName the accountName value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the cost center associated with the enrollment account. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the cost center associated with the enrollment account. + * + * @param costCenter the costCenter value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the owner of the enrollment account. + * + * @return the accountOwner value + */ + public String accountOwner() { + return this.accountOwner; + } + + /** + * Set the owner of the enrollment account. + * + * @param accountOwner the accountOwner value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withAccountOwner(String accountOwner) { + this.accountOwner = accountOwner; + return this; + } + + /** + * Get the status of the enrollment account. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the enrollment account. + * + * @param status the status value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the start date of the enrollment account. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set the start date of the enrollment account. + * + * @param startDate the startDate value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the end date of the enrollment account. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set the end date of the enrollment account. + * + * @param endDate the endDate value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get associated department. By default this is not populated, unless it's specified in $expand. + * + * @return the department value + */ + public DepartmentInner department() { + return this.department; + } + + /** + * Set associated department. By default this is not populated, unless it's specified in $expand. + * + * @param department the department value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withDepartment(DepartmentInner department) { + this.department = department; + 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/EnrollmentAccountListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountListResultImpl.java new file mode 100644 index 0000000000000..04f772ea0518d --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountListResultImpl.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.EnrollmentAccountListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class EnrollmentAccountListResultImpl extends WrapperImpl implements EnrollmentAccountListResult { + private final BillingManager manager; + EnrollmentAccountListResultImpl(EnrollmentAccountListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountListResultInner.java new file mode 100644 index 0000000000000..e955f0cf97275 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountListResultInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of enrollment accounts. + */ +public class EnrollmentAccountListResultInner { + /** + * The list of enrollment accounts. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of enrollment accounts. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsImpl.java new file mode 100644 index 0000000000000..0351443566317 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsImpl.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.EnrollmentAccounts; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccountListResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccount; + +class EnrollmentAccountsImpl extends WrapperImpl implements EnrollmentAccounts { + private final BillingManager manager; + + EnrollmentAccountsImpl(BillingManager manager) { + super(manager.inner().enrollmentAccounts()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private EnrollmentAccountImpl wrapModel(EnrollmentAccountInner inner) { + return new EnrollmentAccountImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountNameAsync(String billingAccountName) { + EnrollmentAccountsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public EnrollmentAccountListResult call(EnrollmentAccountListResultInner inner) { + return new EnrollmentAccountListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName) { + EnrollmentAccountsInner client = this.inner(); + return client.getByEnrollmentAccountIdAsync(billingAccountName, enrollmentAccountName) + .flatMap(new Func1>() { + @Override + public Observable call(EnrollmentAccountInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((EnrollmentAccount)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/EnrollmentAccountsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsInner.java new file mode 100644 index 0000000000000..010b97ff192fa --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/EnrollmentAccountsInner.java @@ -0,0 +1,388 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in EnrollmentAccounts. + */ +public class EnrollmentAccountsInner { + /** The Retrofit service to perform REST calls. */ + private EnrollmentAccountsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of EnrollmentAccountsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EnrollmentAccountsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(EnrollmentAccountsService.class); + this.client = client; + } + + /** + * The interface defining all the services for EnrollmentAccounts to be + * used by Retrofit to perform actually REST calls. + */ + interface EnrollmentAccountsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccounts listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.EnrollmentAccounts getByEnrollmentAccountId" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}") + Observable> getByEnrollmentAccountId(@Path("billingAccountName") String billingAccountName, @Path("enrollmentAccountName") String enrollmentAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the enrollment accounts for a billing account. The operation is supported only for billing accounts with agreement type 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 EnrollmentAccountListResultInner object if successful. + */ + public EnrollmentAccountListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists the enrollment accounts for a billing 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Lists the enrollment accounts for a billing account. The operation is supported only for billing accounts with agreement type 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 EnrollmentAccountListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, EnrollmentAccountListResultInner>() { + @Override + public EnrollmentAccountListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the enrollment accounts for a billing account. The operation is supported only for billing accounts with agreement type 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 EnrollmentAccountListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + final String filter = null; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the enrollment accounts for a billing 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 expand May be used to expand the department. + * @param filter May be used to filter by account name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EnrollmentAccountListResultInner object if successful. + */ + public EnrollmentAccountListResultInner listByBillingAccountName(String billingAccountName, String expand, String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).toBlocking().single().body(); + } + + /** + * Lists the enrollment accounts for a billing 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 expand May be used to expand the department. + * @param filter May be used to filter by account name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, String expand, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter), serviceCallback); + } + + /** + * Lists the enrollment accounts for a billing 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 expand May be used to expand the department. + * @param filter May be used to filter by account name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnrollmentAccountListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName, String expand, String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter).map(new Func1, EnrollmentAccountListResultInner>() { + @Override + public EnrollmentAccountListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the enrollment accounts for a billing 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 expand May be used to expand the department. + * @param filter May be used to filter by account name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnrollmentAccountListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand, String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an enrollment account by ID. 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 EnrollmentAccountInner object if successful. + */ + public EnrollmentAccountInner getByEnrollmentAccountId(String billingAccountName, String enrollmentAccountName) { + return getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName).toBlocking().single().body(); + } + + /** + * Gets an enrollment account by ID. 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 getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName), serviceCallback); + } + + /** + * Gets an enrollment account by ID. 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 EnrollmentAccountInner object + */ + public Observable getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName) { + return getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName).map(new Func1, EnrollmentAccountInner>() { + @Override + public EnrollmentAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an enrollment account by ID. 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 EnrollmentAccountInner object + */ + public Observable> getByEnrollmentAccountIdWithServiceResponseAsync(String billingAccountName, 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."); + } + final String expand = null; + final String filter = null; + return service.getByEnrollmentAccountId(billingAccountName, enrollmentAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByEnrollmentAccountIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets an enrollment account by ID. 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 expand May be used to expand the department. + * @param filter May be used to filter by account name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EnrollmentAccountInner object if successful. + */ + public EnrollmentAccountInner getByEnrollmentAccountId(String billingAccountName, String enrollmentAccountName, String expand, String filter) { + return getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName, expand, filter).toBlocking().single().body(); + } + + /** + * Gets an enrollment account by ID. 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 expand May be used to expand the department. + * @param filter May be used to filter by account name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName, String expand, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName, expand, filter), serviceCallback); + } + + /** + * Gets an enrollment account by ID. 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 expand May be used to expand the department. + * @param filter May be used to filter by account name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnrollmentAccountInner object + */ + public Observable getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName, String expand, String filter) { + return getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName, expand, filter).map(new Func1, EnrollmentAccountInner>() { + @Override + public EnrollmentAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an enrollment account by ID. 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 expand May be used to expand the department. + * @param filter May be used to filter by account name. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnrollmentAccountInner object + */ + public Observable> getByEnrollmentAccountIdWithServiceResponseAsync(String billingAccountName, String enrollmentAccountName, String expand, String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + 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.getByEnrollmentAccountId(billingAccountName, enrollmentAccountName, this.client.apiVersion(), expand, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByEnrollmentAccountIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByEnrollmentAccountIdDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .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/IdParsingUtils.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..9c79128c4a057 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionImpl.java new file mode 100644 index 0000000000000..eb60e81608124 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionImpl.java @@ -0,0 +1,139 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.Instruction; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class InstructionImpl extends CreatableUpdatableImpl implements Instruction, Instruction.Definition, Instruction.Update { + private final BillingManager manager; + private String billingAccountName; + private String billingProfileName; + private String instructionName; + + InstructionImpl(String name, BillingManager manager) { + super(name, new InstructionInner()); + this.manager = manager; + // Set resource name + this.instructionName = name; + // + } + + InstructionImpl(InstructionInner inner, BillingManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.instructionName = inner.name(); + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.billingProfileName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingProfiles"); + this.instructionName = IdParsingUtils.getValueFromIdByName(inner.id(), "instructions"); + // + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + InstructionsInner client = this.manager().inner().instructions(); + return client.putAsync(this.billingAccountName, this.billingProfileName, this.instructionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + InstructionsInner client = this.manager().inner().instructions(); + return client.putAsync(this.billingAccountName, this.billingProfileName, this.instructionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + InstructionsInner client = this.manager().inner().instructions(); + return client.getAsync(this.billingAccountName, this.billingProfileName, this.instructionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public double amount() { + return this.inner().amount(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public DateTime startDate() { + return this.inner().startDate(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public InstructionImpl withExistingBillingProfile(String billingAccountName, String billingProfileName) { + this.billingAccountName = billingAccountName; + this.billingProfileName = billingProfileName; + return this; + } + + @Override + public InstructionImpl withAmount(double amount) { + this.inner().withAmount(amount); + return this; + } + + @Override + public InstructionImpl withEndDate(DateTime endDate) { + this.inner().withEndDate(endDate); + return this; + } + + @Override + public InstructionImpl withStartDate(DateTime startDate) { + this.inner().withStartDate(startDate); + return this; + } + + @Override + public InstructionImpl withCreationDate(DateTime creationDate) { + this.inner().withCreationDate(creationDate); + 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/InstructionInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionInner.java new file mode 100644 index 0000000000000..991f4834ae8fd --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionInner.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An instruction. + */ +@JsonFlatten +public class InstructionInner extends ProxyResource { + /** + * The amount budgeted for this billing instruction. + */ + @JsonProperty(value = "properties.amount", required = true) + private double amount; + + /** + * The date this billing instruction goes into effect. + */ + @JsonProperty(value = "properties.startDate", required = true) + private DateTime startDate; + + /** + * The date this billing instruction is no longer in effect. + */ + @JsonProperty(value = "properties.endDate", required = true) + private DateTime endDate; + + /** + * The date this billing instruction was created. + */ + @JsonProperty(value = "properties.creationDate") + private DateTime creationDate; + + /** + * Get the amount budgeted for this billing instruction. + * + * @return the amount value + */ + public double amount() { + return this.amount; + } + + /** + * Set the amount budgeted for this billing instruction. + * + * @param amount the amount value to set + * @return the InstructionInner object itself. + */ + public InstructionInner withAmount(double amount) { + this.amount = amount; + return this; + } + + /** + * Get the date this billing instruction goes into effect. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set the date this billing instruction goes into effect. + * + * @param startDate the startDate value to set + * @return the InstructionInner object itself. + */ + public InstructionInner withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the date this billing instruction is no longer in effect. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set the date this billing instruction is no longer in effect. + * + * @param endDate the endDate value to set + * @return the InstructionInner object itself. + */ + public InstructionInner withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get the date this billing instruction was created. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Set the date this billing instruction was created. + * + * @param creationDate the creationDate value to set + * @return the InstructionInner object itself. + */ + public InstructionInner withCreationDate(DateTime creationDate) { + this.creationDate = creationDate; + 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/InstructionsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionsImpl.java new file mode 100644 index 0000000000000..a0d99de03e866 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionsImpl.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Instructions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Instruction; + +class InstructionsImpl extends WrapperImpl implements Instructions { + private final BillingManager manager; + + InstructionsImpl(BillingManager manager) { + super(manager.inner().instructions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public InstructionImpl define(String name) { + return wrapModel(name); + } + + private InstructionImpl wrapModel(InstructionInner inner) { + return new InstructionImpl(inner, manager()); + } + + private InstructionImpl wrapModel(String name) { + return new InstructionImpl(name, this.manager()); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + InstructionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Instruction call(InstructionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName, String instructionName) { + InstructionsInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName, instructionName) + .flatMap(new Func1>() { + @Override + public Observable call(InstructionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Instruction)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/InstructionsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionsInner.java new file mode 100644 index 0000000000000..ded6fc2c8bda5 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InstructionsInner.java @@ -0,0 +1,500 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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 com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Instructions. + */ +public class InstructionsInner { + /** The Retrofit service to perform REST calls. */ + private InstructionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of InstructionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InstructionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(InstructionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Instructions to be + * used by Retrofit to perform actually REST calls. + */ + interface InstructionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Instructions listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions") + 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.Instructions get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("instructionName") String instructionName, @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.Instructions put" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/instructions/{instructionName}") + Observable> put(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("instructionName") String instructionName, @Query("api-version") String apiVersion, @Body InstructionInner 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.Instructions listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the instructions by billing profile id. + * + * @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 PagedList<InstructionInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the instructions by billing profile id. + * + * @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(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the instructions by billing profile id. + * + * @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 PagedList<InstructionInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the instructions by billing profile id. + * + * @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 PagedList<InstructionInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the instructions by billing profile id. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstructionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InstructionInner object if successful. + */ + public InstructionInner get(String billingAccountName, String billingProfileName, String instructionName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName).toBlocking().single().body(); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String billingProfileName, String instructionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName), serviceCallback); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstructionInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String instructionName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName).map(new Func1, InstructionInner>() { + @Override + public InstructionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstructionInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName, String instructionName) { + 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 (instructionName == null) { + throw new IllegalArgumentException("Parameter instructionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, billingProfileName, instructionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @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 InstructionInner object if successful. + */ + public InstructionInner put(String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters) { + return putWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @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 billingProfileName, String instructionName, InstructionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(putWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName, parameters), serviceCallback); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstructionInner object + */ + public Observable putAsync(String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters) { + return putWithServiceResponseAsync(billingAccountName, billingProfileName, instructionName, parameters).map(new Func1, InstructionInner>() { + @Override + public InstructionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InstructionInner object + */ + public Observable> putWithServiceResponseAsync(String billingAccountName, String billingProfileName, String instructionName, InstructionInner 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 (instructionName == null) { + throw new IllegalArgumentException("Parameter instructionName 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, billingProfileName, instructionName, 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); + } + + /** + * Lists the instructions by billing profile id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InstructionInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the instructions by billing profile id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the instructions by billing profile id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstructionInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the instructions by billing profile id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InstructionInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the instructions by billing profile id. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InstructionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceImpl.java new file mode 100644 index 0000000000000..81c91aba775b7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceImpl.java @@ -0,0 +1,184 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.Invoice; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Amount; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Document; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceType; +import com.microsoft.azure.management.billing.v2019_10_01_preview.PaymentProperties; +import com.microsoft.azure.management.billing.v2019_10_01_preview.RebillDocumentType; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceStatus; + +class InvoiceImpl extends IndexableRefreshableWrapperImpl implements Invoice { + private final BillingManager manager; + private String billingAccountName; + private String invoiceName; + + InvoiceImpl(InvoiceInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.invoiceName = IdParsingUtils.getValueFromIdByName(inner.id(), "invoices"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + InvoicesInner client = this.manager().inner().invoices(); + return client.getBillingAccountInvoiceAsync(this.billingAccountName, this.invoiceName); + } + + + + @Override + public Amount amountDue() { + return this.inner().amountDue(); + } + + @Override + public Amount azurePrepaymentApplied() { + return this.inner().azurePrepaymentApplied(); + } + + @Override + public Amount billedAmount() { + return this.inner().billedAmount(); + } + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public Amount creditAmount() { + return this.inner().creditAmount(); + } + + @Override + public List documents() { + return this.inner().documents(); + } + + @Override + public DateTime dueDate() { + return this.inner().dueDate(); + } + + @Override + public Amount freeAzureCreditApplied() { + return this.inner().freeAzureCreditApplied(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime invoiceDate() { + return this.inner().invoiceDate(); + } + + @Override + public DateTime invoicePeriodEndDate() { + return this.inner().invoicePeriodEndDate(); + } + + @Override + public DateTime invoicePeriodStartDate() { + return this.inner().invoicePeriodStartDate(); + } + + @Override + public InvoiceType invoiceType() { + return this.inner().invoiceType(); + } + + @Override + public Boolean isMonthlyInvoice() { + return this.inner().isMonthlyInvoice(); + } + + @Override + public String latestInvoiceId() { + return this.inner().latestInvoiceId(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List payments() { + return this.inner().payments(); + } + + @Override + public String purchaseOrderNumber() { + return this.inner().purchaseOrderNumber(); + } + + @Override + public RebillDocumentType rebillDocumentType() { + return this.inner().rebillDocumentType(); + } + + @Override + public String rebilledInvoiceId() { + return this.inner().rebilledInvoiceId(); + } + + @Override + public InvoiceStatus status() { + return this.inner().status(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public Amount subTotal() { + return this.inner().subTotal(); + } + + @Override + public Amount taxAmount() { + return this.inner().taxAmount(); + } + + @Override + public Amount totalAmount() { + return this.inner().totalAmount(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceInner.java new file mode 100644 index 0000000000000..39f4fd6fc7747 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceInner.java @@ -0,0 +1,416 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceStatus; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Amount; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceType; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Document; +import com.microsoft.azure.management.billing.v2019_10_01_preview.PaymentProperties; +import com.microsoft.azure.management.billing.v2019_10_01_preview.RebillDocumentType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An invoice. + */ +@JsonFlatten +public class InvoiceInner extends ProxyResource { + /** + * The due date for the invoice. + */ + @JsonProperty(value = "properties.dueDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime dueDate; + + /** + * The date when the invoice was generated. + */ + @JsonProperty(value = "properties.invoiceDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime invoiceDate; + + /** + * The current status of the invoice. Possible values include: 'Due', + * 'OverDue', 'Paid', 'Void'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private InvoiceStatus status; + + /** + * The amount due as of now. + */ + @JsonProperty(value = "properties.amountDue", access = JsonProperty.Access.WRITE_ONLY) + private Amount amountDue; + + /** + * The amount of Azure prepayment applied to the charges. This field is + * applicable to billing accounts with agreement type Microsoft Customer + * Agreement. + */ + @JsonProperty(value = "properties.azurePrepaymentApplied", access = JsonProperty.Access.WRITE_ONLY) + private Amount azurePrepaymentApplied; + + /** + * The total charges for the invoice billing period. + */ + @JsonProperty(value = "properties.billedAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount billedAmount; + + /** + * The total refund for returns and cancellations during the invoice + * billing period. This field is applicable to billing accounts with + * agreement type Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.creditAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount creditAmount; + + /** + * The amount of free Azure credits applied to the charges. This field is + * applicable to billing accounts with agreement type Microsoft Customer + * Agreement. + */ + @JsonProperty(value = "properties.freeAzureCreditApplied", access = JsonProperty.Access.WRITE_ONLY) + private Amount freeAzureCreditApplied; + + /** + * The pre-tax amount due. This field is applicable to billing accounts + * with agreement type Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.subTotal", access = JsonProperty.Access.WRITE_ONLY) + private Amount subTotal; + + /** + * The amount of tax charged for the billing period. This field is + * applicable to billing accounts with agreement type Microsoft Customer + * Agreement. + */ + @JsonProperty(value = "properties.taxAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount taxAmount; + + /** + * The amount due when the invoice was generated. This field is applicable + * to billing accounts with agreement type Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.totalAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount totalAmount; + + /** + * The start date of the billing period for which the invoice is generated. + */ + @JsonProperty(value = "properties.invoicePeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime invoicePeriodStartDate; + + /** + * The end date of the billing period for which the invoice is generated. + */ + @JsonProperty(value = "properties.invoicePeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime invoicePeriodEndDate; + + /** + * Invoice type. Possible values include: 'AzureService', + * 'AzureMarketplace', 'AzureSupport'. + */ + @JsonProperty(value = "properties.invoiceType", access = JsonProperty.Access.WRITE_ONLY) + private InvoiceType invoiceType; + + /** + * Specifies if the invoice is generated as part of monthly invoicing cycle + * or not. This field is applicable to billing accounts with agreement type + * Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.isMonthlyInvoice", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isMonthlyInvoice; + + /** + * The ID of the billing profile for which the invoice is generated. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile for which the invoice is generated. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * An optional purchase order number for the invoice. + */ + @JsonProperty(value = "properties.purchaseOrderNumber", access = JsonProperty.Access.WRITE_ONLY) + private String purchaseOrderNumber; + + /** + * List of documents available to download such as invoice and tax receipt. + */ + @JsonProperty(value = "properties.documents", access = JsonProperty.Access.WRITE_ONLY) + private List documents; + + /** + * List of payments. + */ + @JsonProperty(value = "properties.payments", access = JsonProperty.Access.WRITE_ONLY) + private List payments; + + /** + * The ID of the subscription for which the invoice is generated. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * The type of the document generated when an Enterprise Agreement invoice + * is rebilled. Possible values include: 'Credit', 'Rebill', 'Original'. + */ + @JsonProperty(value = "properties.rebillDetails.rebillDocumentType") + private RebillDocumentType rebillDocumentType; + + /** + * The ID of the invoice generated when an Enterprise Agreement invoice is + * rebilled. + */ + @JsonProperty(value = "properties.rebillDetails.rebilledInvoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String rebilledInvoiceId; + + /** + * The ID of the latest invoice generated when an Enterprise Agreement + * invoice is rebilled. + */ + @JsonProperty(value = "properties.rebillDetails.latestInvoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String latestInvoiceId; + + /** + * Get the due date for the invoice. + * + * @return the dueDate value + */ + public DateTime dueDate() { + return this.dueDate; + } + + /** + * Get the date when the invoice was generated. + * + * @return the invoiceDate value + */ + public DateTime invoiceDate() { + return this.invoiceDate; + } + + /** + * Get the current status of the invoice. Possible values include: 'Due', 'OverDue', 'Paid', 'Void'. + * + * @return the status value + */ + public InvoiceStatus status() { + return this.status; + } + + /** + * Get the amount due as of now. + * + * @return the amountDue value + */ + public Amount amountDue() { + return this.amountDue; + } + + /** + * Get the amount of Azure prepayment applied to the charges. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the azurePrepaymentApplied value + */ + public Amount azurePrepaymentApplied() { + return this.azurePrepaymentApplied; + } + + /** + * Get the total charges for the invoice billing period. + * + * @return the billedAmount value + */ + public Amount billedAmount() { + return this.billedAmount; + } + + /** + * Get the total refund for returns and cancellations during the invoice billing period. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the creditAmount value + */ + public Amount creditAmount() { + return this.creditAmount; + } + + /** + * Get the amount of free Azure credits applied to the charges. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the freeAzureCreditApplied value + */ + public Amount freeAzureCreditApplied() { + return this.freeAzureCreditApplied; + } + + /** + * Get the pre-tax amount due. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the subTotal value + */ + public Amount subTotal() { + return this.subTotal; + } + + /** + * Get the amount of tax charged for the billing period. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the taxAmount value + */ + public Amount taxAmount() { + return this.taxAmount; + } + + /** + * Get the amount due when the invoice was generated. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the totalAmount value + */ + public Amount totalAmount() { + return this.totalAmount; + } + + /** + * Get the start date of the billing period for which the invoice is generated. + * + * @return the invoicePeriodStartDate value + */ + public DateTime invoicePeriodStartDate() { + return this.invoicePeriodStartDate; + } + + /** + * Get the end date of the billing period for which the invoice is generated. + * + * @return the invoicePeriodEndDate value + */ + public DateTime invoicePeriodEndDate() { + return this.invoicePeriodEndDate; + } + + /** + * Get invoice type. Possible values include: 'AzureService', 'AzureMarketplace', 'AzureSupport'. + * + * @return the invoiceType value + */ + public InvoiceType invoiceType() { + return this.invoiceType; + } + + /** + * Get specifies if the invoice is generated as part of monthly invoicing cycle or not. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the isMonthlyInvoice value + */ + public Boolean isMonthlyInvoice() { + return this.isMonthlyInvoice; + } + + /** + * Get the ID of the billing profile for which the invoice is generated. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile for which the invoice is generated. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get an optional purchase order number for the invoice. + * + * @return the purchaseOrderNumber value + */ + public String purchaseOrderNumber() { + return this.purchaseOrderNumber; + } + + /** + * Get list of documents available to download such as invoice and tax receipt. + * + * @return the documents value + */ + public List documents() { + return this.documents; + } + + /** + * Get list of payments. + * + * @return the payments value + */ + public List payments() { + return this.payments; + } + + /** + * Get the ID of the subscription for which the invoice is generated. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the type of the document generated when an Enterprise Agreement invoice is rebilled. Possible values include: 'Credit', 'Rebill', 'Original'. + * + * @return the rebillDocumentType value + */ + public RebillDocumentType rebillDocumentType() { + return this.rebillDocumentType; + } + + /** + * Set the type of the document generated when an Enterprise Agreement invoice is rebilled. Possible values include: 'Credit', 'Rebill', 'Original'. + * + * @param rebillDocumentType the rebillDocumentType value to set + * @return the InvoiceInner object itself. + */ + public InvoiceInner withRebillDocumentType(RebillDocumentType rebillDocumentType) { + this.rebillDocumentType = rebillDocumentType; + return this; + } + + /** + * Get the ID of the invoice generated when an Enterprise Agreement invoice is rebilled. + * + * @return the rebilledInvoiceId value + */ + public String rebilledInvoiceId() { + return this.rebilledInvoiceId; + } + + /** + * Get the ID of the latest invoice generated when an Enterprise Agreement invoice is rebilled. + * + * @return the latestInvoiceId value + */ + public String latestInvoiceId() { + return this.latestInvoiceId; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceListResultImpl.java new file mode 100644 index 0000000000000..e5add162c32ce --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceListResultImpl.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.InvoiceListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class InvoiceListResultImpl extends WrapperImpl implements InvoiceListResult { + private final BillingManager manager; + InvoiceListResultImpl(InvoiceListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceListResultInner.java new file mode 100644 index 0000000000000..c474c98b8b696 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceListResultInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of invoices. + */ +public class InvoiceListResultInner { + /** + * The list of invoices. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of invoices. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionBillingProfileBillingAccountTransferDetailsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionBillingProfileBillingAccountTransferDetailsImpl.java new file mode 100644 index 0000000000000..ac9123c37bdc7 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionBillingProfileBillingAccountTransferDetailsImpl.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.InvoiceSectionBillingProfileBillingAccountTransferDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.DetailedTransferStatus; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransferStatus; + +class InvoiceSectionBillingProfileBillingAccountTransferDetailsImpl extends WrapperImpl implements InvoiceSectionBillingProfileBillingAccountTransferDetails { + private final BillingManager manager; + private String billingAccountName; + private String billingProfileName; + private String invoiceSectionName; + private String transferName; + + InvoiceSectionBillingProfileBillingAccountTransferDetailsImpl(TransferDetailsInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public String billingAccountId() { + return this.inner().billingAccountId(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String canceledBy() { + return this.inner().canceledBy(); + } + + @Override + public DateTime creationTime() { + return this.inner().creationTime(); + } + + @Override + public List detailedTransferStatus() { + return this.inner().detailedTransferStatus(); + } + + @Override + public DateTime expirationTime() { + return this.inner().expirationTime(); + } + + @Override + public String initiatorCustomerType() { + return this.inner().initiatorCustomerType(); + } + + @Override + public String initiatorEmailId() { + return this.inner().initiatorEmailId(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public DateTime lastModifiedTime() { + return this.inner().lastModifiedTime(); + } + + @Override + public String recipientEmailId() { + return this.inner().recipientEmailId(); + } + + @Override + public String resellerId() { + return this.inner().resellerId(); + } + + @Override + public String resellerName() { + return this.inner().resellerName(); + } + + @Override + public TransferStatus transferStatus() { + return this.inner().transferStatus(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionImpl.java new file mode 100644 index 0000000000000..a75bb2c2bcb6f --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionImpl.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.InvoiceSection; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class InvoiceSectionImpl extends CreatableUpdatableImpl implements InvoiceSection, InvoiceSection.Definition, InvoiceSection.Update { + private final BillingManager manager; + private String billingAccountName; + private String billingProfileName; + private String invoiceSectionName; + private String cdisplayName; + private String udisplayName; + + InvoiceSectionImpl(String name, BillingManager manager) { + super(name, new InvoiceSectionInner()); + this.manager = manager; + // Set resource name + this.invoiceSectionName = name; + // + } + + InvoiceSectionImpl(InvoiceSectionInner inner, BillingManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.invoiceSectionName = inner.name(); + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.billingProfileName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingProfiles"); + this.invoiceSectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "invoiceSections"); + // + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + InvoiceSectionsInner client = this.manager().inner().invoiceSections(); + return client.createAsync(this.billingAccountName, this.billingProfileName, this.invoiceSectionName, this.cdisplayName) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + InvoiceSectionsInner client = this.manager().inner().invoiceSections(); + return client.updateAsync(this.billingAccountName, this.billingProfileName, this.invoiceSectionName, this.udisplayName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + InvoiceSectionsInner client = this.manager().inner().invoiceSections(); + return client.getAsync(this.billingAccountName, this.billingProfileName, this.invoiceSectionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public InvoiceSectionImpl withExistingBillingProfile(String billingAccountName, String billingProfileName) { + this.billingAccountName = billingAccountName; + this.billingProfileName = billingProfileName; + return this; + } + + @Override + public InvoiceSectionImpl withDisplayName(String displayName) { + if (isInCreateMode()) { + this.cdisplayName = displayName; + } else { + this.udisplayName = displayName; + } + 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/InvoiceSectionInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionInner.java new file mode 100644 index 0000000000000..1c2ee5963bec5 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionInner.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An invoice section. + */ +@JsonFlatten +public class InvoiceSectionInner extends ProxyResource { + /** + * The name of the invoice section. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Get the name of the invoice section. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the invoice section. + * + * @param displayName the displayName value to set + * @return the InvoiceSectionInner object itself. + */ + public InvoiceSectionInner withDisplayName(String displayName) { + this.displayName = displayName; + 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/InvoiceSectionListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionListResultImpl.java new file mode 100644 index 0000000000000..0c429bfbd735b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionListResultImpl.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.InvoiceSectionListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class InvoiceSectionListResultImpl extends WrapperImpl implements InvoiceSectionListResult { + private final BillingManager manager; + InvoiceSectionListResultImpl(InvoiceSectionListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionListResultInner.java new file mode 100644 index 0000000000000..0a1226108c46f --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionListResultInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of invoice sections. + */ +public class InvoiceSectionListResultInner { + /** + * The list of invoice sections. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of invoice sections. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionWithCreateSubPermissionImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionWithCreateSubPermissionImpl.java new file mode 100644 index 0000000000000..72f41e60eddd5 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionWithCreateSubPermissionImpl.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.InvoiceSectionWithCreateSubPermission; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfileSpendingLimit; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfileStatusReasonCode; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AzurePlan; + +class InvoiceSectionWithCreateSubPermissionImpl extends WrapperImpl implements InvoiceSectionWithCreateSubPermission { + private final BillingManager manager; + InvoiceSectionWithCreateSubPermissionImpl(InvoiceSectionWithCreateSubPermissionInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public BillingProfileSpendingLimit billingProfileSpendingLimit() { + return this.inner().billingProfileSpendingLimit(); + } + + @Override + public Object billingProfileStatus() { + return this.inner().billingProfileStatus(); + } + + @Override + public BillingProfileStatusReasonCode billingProfileStatusReasonCode() { + return this.inner().billingProfileStatusReasonCode(); + } + + @Override + public List enabledAzurePlans() { + return this.inner().enabledAzurePlans(); + } + + @Override + public String invoiceSectionDisplayName() { + return this.inner().invoiceSectionDisplayName(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionWithCreateSubPermissionInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionWithCreateSubPermissionInner.java new file mode 100644 index 0000000000000..b79b4db8fba32 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionWithCreateSubPermissionInner.java @@ -0,0 +1,154 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.BillingProfileStatusReasonCode; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingProfileSpendingLimit; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AzurePlan; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Invoice section properties with create subscription permission. + */ +public class InvoiceSectionWithCreateSubPermissionInner { + /** + * The ID of the invoice section. + */ + @JsonProperty(value = "invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * The name of the invoice section. + */ + @JsonProperty(value = "invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /** + * The ID of the billing profile for the invoice section. + */ + @JsonProperty(value = "billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile for the invoice section. + */ + @JsonProperty(value = "billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * The status of the billing profile. + */ + @JsonProperty(value = "billingProfileStatus", access = JsonProperty.Access.WRITE_ONLY) + private Object billingProfileStatus; + + /** + * Reason for the specified billing profile status. Possible values + * include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired'. + */ + @JsonProperty(value = "billingProfileStatusReasonCode", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileStatusReasonCode billingProfileStatusReasonCode; + + /** + * The billing profile spending limit. Possible values include: 'Off', + * 'On'. + */ + @JsonProperty(value = "billingProfileSpendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileSpendingLimit billingProfileSpendingLimit; + + /** + * Enabled azure plans for the associated billing profile. + */ + @JsonProperty(value = "enabledAzurePlans") + private List enabledAzurePlans; + + /** + * Get the ID of the invoice section. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the name of the invoice section. + * + * @return the invoiceSectionDisplayName value + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the ID of the billing profile for the invoice section. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile for the invoice section. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the status of the billing profile. + * + * @return the billingProfileStatus value + */ + public Object billingProfileStatus() { + return this.billingProfileStatus; + } + + /** + * Get reason for the specified billing profile status. Possible values include: 'PastDue', 'SpendingLimitReached', 'SpendingLimitExpired'. + * + * @return the billingProfileStatusReasonCode value + */ + public BillingProfileStatusReasonCode billingProfileStatusReasonCode() { + return this.billingProfileStatusReasonCode; + } + + /** + * Get the billing profile spending limit. Possible values include: 'Off', 'On'. + * + * @return the billingProfileSpendingLimit value + */ + public BillingProfileSpendingLimit billingProfileSpendingLimit() { + return this.billingProfileSpendingLimit; + } + + /** + * Get enabled azure plans for the associated billing profile. + * + * @return the enabledAzurePlans value + */ + public List enabledAzurePlans() { + return this.enabledAzurePlans; + } + + /** + * Set enabled azure plans for the associated billing profile. + * + * @param enabledAzurePlans the enabledAzurePlans value to set + * @return the InvoiceSectionWithCreateSubPermissionInner object itself. + */ + public InvoiceSectionWithCreateSubPermissionInner withEnabledAzurePlans(List enabledAzurePlans) { + this.enabledAzurePlans = enabledAzurePlans; + 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/InvoiceSectionsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionsImpl.java new file mode 100644 index 0000000000000..221d2304483d3 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionsImpl.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.InvoiceSections; +import rx.Observable; +import rx.functions.Func1; +import rx.Completable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceSectionListResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceSection; + +class InvoiceSectionsImpl extends WrapperImpl implements InvoiceSections { + private final BillingManager manager; + + InvoiceSectionsImpl(BillingManager manager) { + super(manager.inner().invoiceSections()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public InvoiceSectionImpl define(String name) { + return wrapModel(name); + } + + private InvoiceSectionImpl wrapModel(InvoiceSectionInner inner) { + return new InvoiceSectionImpl(inner, manager()); + } + + private InvoiceSectionImpl wrapModel(String name) { + return new InvoiceSectionImpl(name, this.manager()); + } + + @Override + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + InvoiceSectionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public InvoiceSectionListResult call(InvoiceSectionListResultInner inner) { + return new InvoiceSectionListResultImpl(inner, manager()); + } + }); + } + + @Override + public Completable elevateToBillingProfileAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + InvoiceSectionsInner client = this.inner(); + return client.elevateToBillingProfileAsync(billingAccountName, billingProfileName, invoiceSectionName).toCompletable(); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + InvoiceSectionsInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName, invoiceSectionName) + .flatMap(new Func1>() { + @Override + public Observable call(InvoiceSectionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((InvoiceSection)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/InvoiceSectionsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionsInner.java new file mode 100644 index 0000000000000..51a8935243f1c --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoiceSectionsInner.java @@ -0,0 +1,1025 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.azure.management.billing.v2019_10_01_preview.InvoiceSectionCreationRequest; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceSectionsCreateHeaders; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceSectionsUpdateHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +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 InvoiceSections. + */ +public class InvoiceSectionsInner { + /** The Retrofit service to perform REST calls. */ + private InvoiceSectionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of InvoiceSectionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InvoiceSectionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(InvoiceSectionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for InvoiceSections to be + * used by Retrofit to perform actually REST calls. + */ + interface InvoiceSectionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceSections listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections") + 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.InvoiceSections get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceSections create" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") + Observable> create(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body InvoiceSectionCreationRequest parameters, @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.InvoiceSections beginCreate" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") + Observable> beginCreate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body InvoiceSectionCreationRequest parameters, @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.InvoiceSections update" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") + Observable> update(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body InvoiceSectionInner parameters, @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.InvoiceSections beginUpdate" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") + Observable> beginUpdate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body InvoiceSectionInner parameters, @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.InvoiceSections elevateToBillingProfile" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/elevate") + Observable> elevateToBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only 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 InvoiceSectionListResultInner object if successful. + */ + public InvoiceSectionListResultInner listByBillingProfile(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only 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 invoice sections that a user has access to. The operation is supported only 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 InvoiceSectionListResultInner object + */ + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, InvoiceSectionListResultInner>() { + @Override + public InvoiceSectionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only 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 InvoiceSectionListResultInner 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); + } + + /** + * Gets an invoice section by its ID. The operation is supported only 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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner get(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Gets an invoice section by its ID. The operation is supported only 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 getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName), serviceCallback); + } + + /** + * Gets an invoice section by its ID. The operation is supported only 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 InvoiceSectionInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an invoice section by its ID. The operation is supported only 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 InvoiceSectionInner object + */ + public Observable> getWithServiceResponseAsync(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.get(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 = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Creates an invoice section. The operation is supported only 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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner create(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return createWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().last().body(); + } + + /** + * Creates an invoice section. The operation is supported only 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 createAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName), serviceCallback); + } + + /** + * Creates an invoice section. The operation is supported only 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 for the request + */ + public Observable createAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return createWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates an invoice section. The operation is supported only 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 for the request + */ + public Observable> createWithServiceResponseAsync(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."); + } + final String displayName = null; + InvoiceSectionCreationRequest parameters = new InvoiceSectionCreationRequest(); + parameters.withDisplayName(null); + Observable> observable = service.create(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), InvoiceSectionsCreateHeaders.class); + } + /** + * Creates an invoice section. The operation is supported only 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 displayName The name of the 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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner create(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + return createWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName).toBlocking().last().body(); + } + + /** + * Creates an invoice section. The operation is supported only 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 displayName The name of the 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 createAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName), serviceCallback); + } + + /** + * Creates an invoice section. The operation is supported only 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 displayName The name of the invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + return createWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates an invoice section. The operation is supported only 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 displayName The name of the invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + 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."); + } + InvoiceSectionCreationRequest parameters = new InvoiceSectionCreationRequest(); + parameters.withDisplayName(displayName); + Observable> observable = service.create(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), InvoiceSectionsCreateHeaders.class); + } + + /** + * Creates an invoice section. The operation is supported only 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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner beginCreate(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return beginCreateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Creates an invoice section. The operation is supported only 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 beginCreateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName), serviceCallback); + } + + /** + * Creates an invoice section. The operation is supported only 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 InvoiceSectionInner object + */ + public Observable beginCreateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return beginCreateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates an invoice section. The operation is supported only 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 InvoiceSectionInner object + */ + public Observable> beginCreateWithServiceResponseAsync(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."); + } + final String displayName = null; + InvoiceSectionCreationRequest parameters = new InvoiceSectionCreationRequest(); + parameters.withDisplayName(null); + return service.beginCreate(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates an invoice section. The operation is supported only 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 displayName The name of the 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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner beginCreate(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + return beginCreateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName).toBlocking().single().body(); + } + + /** + * Creates an invoice section. The operation is supported only 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 displayName The name of the 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 beginCreateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName), serviceCallback); + } + + /** + * Creates an invoice section. The operation is supported only 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 displayName The name of the invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable beginCreateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + return beginCreateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Creates an invoice section. The operation is supported only 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 displayName The name of the invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + 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."); + } + InvoiceSectionCreationRequest parameters = new InvoiceSectionCreationRequest(); + parameters.withDisplayName(displayName); + return service.beginCreate(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginCreateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginCreateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, InvoiceSectionsCreateHeaders.class); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner update(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().last().body(); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 updateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName), serviceCallback); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 for the request + */ + public Observable updateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 for the request + */ + public Observable> updateWithServiceResponseAsync(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."); + } + final String displayName = null; + InvoiceSectionInner parameters = new InvoiceSectionInner(); + parameters.withDisplayName(null); + Observable> observable = service.update(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), InvoiceSectionsUpdateHeaders.class); + } + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 displayName The name of the 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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner update(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName).toBlocking().last().body(); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 displayName The name of the 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 updateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName), serviceCallback); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 displayName The name of the invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 displayName The name of the invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + 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."); + } + InvoiceSectionInner parameters = new InvoiceSectionInner(); + parameters.withDisplayName(displayName); + Observable> observable = service.update(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), InvoiceSectionsUpdateHeaders.class); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner beginUpdate(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return beginUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 beginUpdateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName), serviceCallback); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 InvoiceSectionInner object + */ + public Observable beginUpdateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return beginUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 InvoiceSectionInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(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."); + } + final String displayName = null; + InvoiceSectionInner parameters = new InvoiceSectionInner(); + parameters.withDisplayName(null); + return service.beginUpdate(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 displayName The name of the 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 InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner beginUpdate(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + return beginUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName).toBlocking().single().body(); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 displayName The name of the 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 beginUpdateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName), serviceCallback); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 displayName The name of the invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable beginUpdateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + return beginUpdateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, displayName).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Updates an invoice section. Currently, only displayName can be updated. The operation is supported only 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 displayName The name of the invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String displayName) { + 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."); + } + InvoiceSectionInner parameters = new InvoiceSectionInner(); + parameters.withDisplayName(displayName); + return service.beginUpdate(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, InvoiceSectionsUpdateHeaders.class); + } + + /** + * Gives the caller permissions on an invoice section based on their billing profile access. The operation is supported only 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 + */ + public void elevateToBillingProfile(String billingAccountName, String billingProfileName, String invoiceSectionName) { + elevateToBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Gives the caller permissions on an invoice section based on their billing profile access. The operation is supported only 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 elevateToBillingProfileAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(elevateToBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName), serviceCallback); + } + + /** + * Gives the caller permissions on an invoice section based on their billing profile access. The operation is supported only 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 {@link ServiceResponse} object if successful. + */ + public Observable elevateToBillingProfileAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return elevateToBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gives the caller permissions on an invoice section based on their billing profile access. The operation is supported only 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 {@link ServiceResponse} object if successful. + */ + public Observable> elevateToBillingProfileWithServiceResponseAsync(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."); + } + return service.elevateToBillingProfile(billingAccountName, billingProfileName, invoiceSectionName, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = elevateToBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse elevateToBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, 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/InvoicesImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoicesImpl.java new file mode 100644 index 0000000000000..ddad0475448b9 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoicesImpl.java @@ -0,0 +1,118 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.Invoices; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceListResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Invoice; + +class InvoicesImpl extends WrapperImpl implements Invoices { + private final BillingManager manager; + + InvoicesImpl(BillingManager manager) { + super(manager.inner().invoices()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private InvoiceImpl wrapModel(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountAsync(String billingAccountName, String periodStartDate, String periodEndDate) { + InvoicesInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate) + .map(new Func1() { + @Override + public InvoiceListResult call(InvoiceListResultInner inner) { + return new InvoiceListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + InvoicesInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .map(new Func1() { + @Override + public InvoiceListResult call(InvoiceListResultInner inner) { + return new InvoiceListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceName) { + InvoicesInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName, invoiceName) + .map(new Func1() { + @Override + public Invoice call(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingSubscriptionAsync(final String billingAccountName, final String billingSubscriptionName, final String periodStartDate, final String periodEndDate) { + InvoicesInner client = this.inner(); + return client.listByBillingSubscriptionAsync(billingAccountName, billingSubscriptionName, periodStartDate, periodEndDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Invoice call(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByIdAsync(String billingAccountName, String billingSubscriptionName, String invoiceName) { + InvoicesInner client = this.inner(); + return client.getByIdAsync(billingAccountName, billingSubscriptionName, invoiceName) + .map(new Func1() { + @Override + public Invoice call(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getBillingAccountInvoiceAsync(String billingAccountName, String invoiceName) { + InvoicesInner client = this.inner(); + return client.getBillingAccountInvoiceAsync(billingAccountName, invoiceName) + .flatMap(new Func1>() { + @Override + public Observable call(InvoiceInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Invoice)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/InvoicesInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoicesInner.java new file mode 100644 index 0000000000000..1ebeb6ad733f3 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/InvoicesInner.java @@ -0,0 +1,787 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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; + +/** + * An instance of this class provides access to all the operations defined + * in Invoices. + */ +public class InvoicesInner { + /** The Retrofit service to perform REST calls. */ + private InvoicesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of InvoicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InvoicesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(InvoicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Invoices to be + * used by Retrofit to perform actually REST calls. + */ + interface InvoicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Invoices listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Invoices getBillingAccountInvoice" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}") + Observable> getBillingAccountInvoice(@Path("billingAccountName") String billingAccountName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Invoices listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Invoices get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Invoices listByBillingSubscription" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/invoices") + Observable> listByBillingSubscription(@Path("billingAccountName") String billingAccountName, @Path("billingSubscriptionName") String billingSubscriptionName, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @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.Invoices getById" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/invoices/{invoiceName}") + Observable> getById(@Path("billingAccountName") String billingAccountName, @Path("billingSubscriptionName") String billingSubscriptionName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Invoices listByBillingSubscriptionNext" }) + @GET + Observable> listByBillingSubscriptionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the invoices for a billing account for a given start date and end date. 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 periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InvoiceListResultInner object if successful. + */ + public InvoiceListResultInner listByBillingAccount(String billingAccountName, String periodStartDate, String periodEndDate) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate).toBlocking().single().body(); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. 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 periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @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, String periodStartDate, String periodEndDate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate), serviceCallback); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. 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 periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceListResultInner object + */ + public Observable listByBillingAccountAsync(String billingAccountName, String periodStartDate, String periodEndDate) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate).map(new Func1, InvoiceListResultInner>() { + @Override + public InvoiceListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. 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 periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceListResultInner object + */ + public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName, String periodStartDate, String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), periodStartDate, periodEndDate, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an invoice by billing account name and ID. 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 invoiceName The ID that uniquely identifies an invoice. + * @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 InvoiceInner object if successful. + */ + public InvoiceInner getBillingAccountInvoice(String billingAccountName, String invoiceName) { + return getBillingAccountInvoiceWithServiceResponseAsync(billingAccountName, invoiceName).toBlocking().single().body(); + } + + /** + * Gets an invoice by billing account name and ID. 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 invoiceName The ID that uniquely identifies an invoice. + * @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 getBillingAccountInvoiceAsync(String billingAccountName, String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getBillingAccountInvoiceWithServiceResponseAsync(billingAccountName, invoiceName), serviceCallback); + } + + /** + * Gets an invoice by billing account name and ID. 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 invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable getBillingAccountInvoiceAsync(String billingAccountName, String invoiceName) { + return getBillingAccountInvoiceWithServiceResponseAsync(billingAccountName, invoiceName).map(new Func1, InvoiceInner>() { + @Override + public InvoiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an invoice by billing account name and ID. 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 invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable> getBillingAccountInvoiceWithServiceResponseAsync(String billingAccountName, String invoiceName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getBillingAccountInvoice(billingAccountName, invoiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getBillingAccountInvoiceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getBillingAccountInvoiceDelegate(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 invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InvoiceListResultInner object if successful. + */ + public InvoiceListResultInner listByBillingProfile(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).toBlocking().single().body(); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate), serviceCallback); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceListResultInner object + */ + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).map(new Func1, InvoiceListResultInner>() { + @Override + public InvoiceListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceListResultInner object + */ + public Observable> listByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + return service.listByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), periodStartDate, periodEndDate, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @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 InvoiceInner object if successful. + */ + public InvoiceInner get(String billingAccountName, String billingProfileName, String invoiceName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName).toBlocking().single().body(); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String billingProfileName, String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName), serviceCallback); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName).map(new Func1, InvoiceInner>() { + @Override + public InvoiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceName) { + 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 (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, billingProfileName, invoiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the invoices for a subscription. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InvoiceInner> object if successful. + */ + public PagedList listByBillingSubscription(final String billingAccountName, final String billingSubscriptionName, final String periodStartDate, final String periodEndDate) { + ServiceResponse> response = listByBillingSubscriptionSinglePageAsync(billingAccountName, billingSubscriptionName, periodStartDate, periodEndDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoices for a subscription. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingSubscriptionAsync(final String billingAccountName, final String billingSubscriptionName, final String periodStartDate, final String periodEndDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingSubscriptionSinglePageAsync(billingAccountName, billingSubscriptionName, periodStartDate, periodEndDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoices for a subscription. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable> listByBillingSubscriptionAsync(final String billingAccountName, final String billingSubscriptionName, final String periodStartDate, final String periodEndDate) { + return listByBillingSubscriptionWithServiceResponseAsync(billingAccountName, billingSubscriptionName, periodStartDate, periodEndDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoices for a subscription. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable>> listByBillingSubscriptionWithServiceResponseAsync(final String billingAccountName, final String billingSubscriptionName, final String periodStartDate, final String periodEndDate) { + return listByBillingSubscriptionSinglePageAsync(billingAccountName, billingSubscriptionName, periodStartDate, periodEndDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoices for a subscription. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingSubscriptionName The ID that uniquely identifies a subscription. + ServiceResponse> * @param periodStartDate Invoice period start date. + ServiceResponse> * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingSubscriptionSinglePageAsync(final String billingAccountName, final String billingSubscriptionName, final String periodStartDate, final String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingSubscription(billingAccountName, billingSubscriptionName, periodStartDate, periodEndDate, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingSubscriptionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingSubscriptionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets an invoice by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @param invoiceName The ID that uniquely identifies an invoice. + * @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 InvoiceInner object if successful. + */ + public InvoiceInner getById(String billingAccountName, String billingSubscriptionName, String invoiceName) { + return getByIdWithServiceResponseAsync(billingAccountName, billingSubscriptionName, invoiceName).toBlocking().single().body(); + } + + /** + * Gets an invoice by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @param invoiceName The ID that uniquely identifies an invoice. + * @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 getByIdAsync(String billingAccountName, String billingSubscriptionName, String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByIdWithServiceResponseAsync(billingAccountName, billingSubscriptionName, invoiceName), serviceCallback); + } + + /** + * Gets an invoice by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable getByIdAsync(String billingAccountName, String billingSubscriptionName, String invoiceName) { + return getByIdWithServiceResponseAsync(billingAccountName, billingSubscriptionName, invoiceName).map(new Func1, InvoiceInner>() { + @Override + public InvoiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets an invoice by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable> getByIdWithServiceResponseAsync(String billingAccountName, String billingSubscriptionName, String invoiceName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getById(billingAccountName, billingSubscriptionName, invoiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByIdDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByIdDelegate(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 invoices for a subscription. + * + * @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<InvoiceInner> object if successful. + */ + public PagedList listByBillingSubscriptionNext(final String nextPageLink) { + ServiceResponse> response = listByBillingSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingSubscriptionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the invoices for a subscription. + * + * @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> listByBillingSubscriptionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingSubscriptionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingSubscriptionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the invoices for a subscription. + * + * @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<InvoiceInner> object + */ + public Observable> listByBillingSubscriptionNextAsync(final String nextPageLink) { + return listByBillingSubscriptionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the invoices for a subscription. + * + * @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<InvoiceInner> object + */ + public Observable>> listByBillingSubscriptionNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingSubscriptionNextSinglePageAsync(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(listByBillingSubscriptionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the invoices for a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingSubscriptionNextSinglePageAsync(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.listByBillingSubscriptionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingSubscriptionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingSubscriptionNextDelegate(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/OperationImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationImpl.java new file mode 100644 index 0000000000000..e1e89c027550d --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final BillingManager manager; + OperationImpl(OperationInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationInner.java new file mode 100644 index 0000000000000..5eaac2cc136bd --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Billing REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..0b08e05a41448 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final BillingManager manager; + + OperationsImpl(BillingManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationsInner.java new file mode 100644 index 0000000000000..82ef160111517 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Operations list" }) + @GET("providers/Microsoft.Billing/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the available billing REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the available billing REST API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the available billing REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available billing REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the available billing REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the available billing REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the available billing REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the available billing REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available billing REST API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the available billing REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PageImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..ef89fd210e8c9 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PartnerTransfersImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PartnerTransfersImpl.java new file mode 100644 index 0000000000000..f6290a8f3164a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PartnerTransfersImpl.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.PartnerTransfers; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.CustomerBillingProfileBillingAccountTransferDetails; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceSectionBillingProfileBillingAccountTransferDetails; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InitiateTransferRequest; + +class PartnerTransfersImpl extends WrapperImpl implements PartnerTransfers { + private final BillingManager manager; + + PartnerTransfersImpl(BillingManager manager) { + super(manager.inner().partnerTransfers()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private CustomerBillingProfileBillingAccountTransferDetailsImpl wrapModel(TransferDetailsInner inner) { + return new CustomerBillingProfileBillingAccountTransferDetailsImpl(inner, manager()); + } + + @Override + public Observable listAsync(final String billingAccountName, final String billingProfileName, final String customerName) { + PartnerTransfersInner client = this.inner(); + return client.listAsync(billingAccountName, billingProfileName, customerName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public CustomerBillingProfileBillingAccountTransferDetails call(TransferDetailsInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName, String customerName, String transferName) { + PartnerTransfersInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName, customerName, transferName) + .flatMap(new Func1>() { + @Override + public Observable call(TransferDetailsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((CustomerBillingProfileBillingAccountTransferDetails)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable cancelAsync(String billingAccountName, String billingProfileName, String customerName, String transferName) { + PartnerTransfersInner client = this.inner(); + return client.cancelAsync(billingAccountName, billingProfileName, customerName, transferName).toCompletable(); + } + + @Override + public Observable initiateAsync(String billingAccountName, String billingProfileName, String customerName, InitiateTransferRequest parameters) { + PartnerTransfersInner client = this.inner(); + return client.initiateAsync(billingAccountName, billingProfileName, customerName, parameters) + .map(new Func1() { + @Override + public InvoiceSectionBillingProfileBillingAccountTransferDetails call(TransferDetailsInner inner) { + return new InvoiceSectionBillingProfileBillingAccountTransferDetailsImpl(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/PartnerTransfersInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PartnerTransfersInner.java new file mode 100644 index 0000000000000..bf1bb5a17cf58 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PartnerTransfersInner.java @@ -0,0 +1,605 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InitiateTransferRequest; +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; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PartnerTransfers. + */ +public class PartnerTransfersInner { + /** The Retrofit service to perform REST calls. */ + private PartnerTransfersService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of PartnerTransfersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PartnerTransfersInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(PartnerTransfersService.class); + this.client = client; + } + + /** + * The interface defining all the services for PartnerTransfers to be + * used by Retrofit to perform actually REST calls. + */ + interface PartnerTransfersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.PartnerTransfers initiate" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/initiateTransfer") + Observable> initiate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("customerName") String customerName, @Body InitiateTransferRequest 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.PartnerTransfers get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("customerName") String customerName, @Path("transferName") String transferName, @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.PartnerTransfers cancel" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}", method = "DELETE", hasBody = true) + Observable> cancel(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("customerName") String customerName, @Path("transferName") String transferName, @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.PartnerTransfers list" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers") + Observable> list(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("customerName") String customerName, @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.PartnerTransfers listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the initiate transfer 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 TransferDetailsInner object if successful. + */ + public TransferDetailsInner initiate(String billingAccountName, String billingProfileName, String customerName, InitiateTransferRequest parameters) { + return initiateWithServiceResponseAsync(billingAccountName, billingProfileName, customerName, parameters).toBlocking().single().body(); + } + + /** + * Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the initiate transfer 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 initiateAsync(String billingAccountName, String billingProfileName, String customerName, InitiateTransferRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(initiateWithServiceResponseAsync(billingAccountName, billingProfileName, customerName, parameters), serviceCallback); + } + + /** + * Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the initiate transfer operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable initiateAsync(String billingAccountName, String billingProfileName, String customerName, InitiateTransferRequest parameters) { + return initiateWithServiceResponseAsync(billingAccountName, billingProfileName, customerName, parameters).map(new Func1, TransferDetailsInner>() { + @Override + public TransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the initiate transfer operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable> initiateWithServiceResponseAsync(String billingAccountName, String billingProfileName, String customerName, InitiateTransferRequest 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 (customerName == null) { + throw new IllegalArgumentException("Parameter customerName 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.initiate(billingAccountName, billingProfileName, customerName, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = initiateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse initiateDelegate(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 a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param transferName The ID that uniquely identifies a transfer request. + * @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 TransferDetailsInner object if successful. + */ + public TransferDetailsInner get(String billingAccountName, String billingProfileName, String customerName, String transferName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, customerName, transferName).toBlocking().single().body(); + } + + /** + * Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param transferName The ID that uniquely identifies a transfer request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String billingProfileName, String customerName, String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, customerName, transferName), serviceCallback); + } + + /** + * Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String customerName, String transferName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, customerName, transferName).map(new Func1, TransferDetailsInner>() { + @Override + public TransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName, String customerName, String transferName) { + 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 (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + return service.get(billingAccountName, billingProfileName, customerName, transferName, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param transferName The ID that uniquely identifies a transfer request. + * @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 TransferDetailsInner object if successful. + */ + public TransferDetailsInner cancel(String billingAccountName, String billingProfileName, String customerName, String transferName) { + return cancelWithServiceResponseAsync(billingAccountName, billingProfileName, customerName, transferName).toBlocking().single().body(); + } + + /** + * Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param transferName The ID that uniquely identifies a transfer request. + * @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 cancelAsync(String billingAccountName, String billingProfileName, String customerName, String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(billingAccountName, billingProfileName, customerName, transferName), serviceCallback); + } + + /** + * Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable cancelAsync(String billingAccountName, String billingProfileName, String customerName, String transferName) { + return cancelWithServiceResponseAsync(billingAccountName, billingProfileName, customerName, transferName).map(new Func1, TransferDetailsInner>() { + @Override + public TransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable> cancelWithServiceResponseAsync(String billingAccountName, String billingProfileName, String customerName, String transferName) { + 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 (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + return service.cancel(billingAccountName, billingProfileName, customerName, transferName, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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 transfer requests sent to a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @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<TransferDetailsInner> object if successful. + */ + public PagedList list(final String billingAccountName, final String billingProfileName, final String customerName) { + ServiceResponse> response = listSinglePageAsync(billingAccountName, billingProfileName, customerName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String billingAccountName, final String billingProfileName, final String customerName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(billingAccountName, billingProfileName, customerName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransferDetailsInner> object + */ + public Observable> listAsync(final String billingAccountName, final String billingProfileName, final String customerName) { + return listWithServiceResponseAsync(billingAccountName, billingProfileName, customerName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransferDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String customerName) { + return listSinglePageAsync(billingAccountName, billingProfileName, customerName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransferDetailsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String billingAccountName, final String billingProfileName, final String customerName) { + 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 (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + return service.list(billingAccountName, billingProfileName, customerName, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<TransferDetailsInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner 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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<TransferDetailsInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<TransferDetailsInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transfer requests sent to a customer. The operation is supported only for billing accounts with agreement type Microsoft Partner 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<TransferDetailsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodImpl.java new file mode 100644 index 0000000000000..d8190a88580ba --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodImpl.java @@ -0,0 +1,66 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.PaymentMethod; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.PaymentMethodType; + +class PaymentMethodImpl extends WrapperImpl implements PaymentMethod { + private final BillingManager manager; + + PaymentMethodImpl(PaymentMethodInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public String currency() { + return this.inner().currency(); + } + + @Override + public String details() { + return this.inner().details(); + } + + @Override + public String expiration() { + return this.inner().expiration(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public PaymentMethodType paymentMethodType() { + return this.inner().paymentMethodType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodInner.java new file mode 100644 index 0000000000000..1c15fe8c8b7c3 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodInner.java @@ -0,0 +1,93 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.PaymentMethodType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A payment method. + */ +@JsonFlatten +public class PaymentMethodInner extends ProxyResource { + /** + * The type of payment method. Possible values include: 'Credits', + * 'ChequeWire'. + */ + @JsonProperty(value = "properties.paymentMethodType") + private PaymentMethodType paymentMethodType; + + /** + * Details about the payment method. + */ + @JsonProperty(value = "properties.details", access = JsonProperty.Access.WRITE_ONLY) + private String details; + + /** + * Expiration month and year. + */ + @JsonProperty(value = "properties.expiration", access = JsonProperty.Access.WRITE_ONLY) + private String expiration; + + /** + * The currency associated with the payment method. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * Get the type of payment method. Possible values include: 'Credits', 'ChequeWire'. + * + * @return the paymentMethodType value + */ + public PaymentMethodType paymentMethodType() { + return this.paymentMethodType; + } + + /** + * Set the type of payment method. Possible values include: 'Credits', 'ChequeWire'. + * + * @param paymentMethodType the paymentMethodType value to set + * @return the PaymentMethodInner object itself. + */ + public PaymentMethodInner withPaymentMethodType(PaymentMethodType paymentMethodType) { + this.paymentMethodType = paymentMethodType; + return this; + } + + /** + * Get details about the payment method. + * + * @return the details value + */ + public String details() { + return this.details; + } + + /** + * Get expiration month and year. + * + * @return the expiration value + */ + public String expiration() { + return this.expiration; + } + + /** + * Get the currency associated with the payment method. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodsImpl.java new file mode 100644 index 0000000000000..e3b087eca905e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodsImpl.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.PaymentMethods; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.PaymentMethod; + +class PaymentMethodsImpl extends WrapperImpl implements PaymentMethods { + private final BillingManager manager; + + PaymentMethodsImpl(BillingManager manager) { + super(manager.inner().paymentMethods()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private PaymentMethodImpl wrapModel(PaymentMethodInner inner) { + return new PaymentMethodImpl(inner, manager()); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + PaymentMethodsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PaymentMethod call(PaymentMethodInner inner) { + return new PaymentMethodImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + PaymentMethodsInner 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 PaymentMethod call(PaymentMethodInner inner) { + return 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/PaymentMethodsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodsInner.java new file mode 100644 index 0000000000000..d06c89835348e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PaymentMethodsInner.java @@ -0,0 +1,531 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PaymentMethods. + */ +public class PaymentMethodsInner { + /** The Retrofit service to perform REST calls. */ + private PaymentMethodsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of PaymentMethodsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PaymentMethodsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(PaymentMethodsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PaymentMethods to be + * used by Retrofit to perform actually REST calls. + */ + interface PaymentMethodsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.PaymentMethods listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.PaymentMethods listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethods") + 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.PaymentMethods 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.PaymentMethods listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the payment Methods for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<PaymentMethodInner> 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 payment Methods for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer 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 payment Methods for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<PaymentMethodInner> 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 payment Methods for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<PaymentMethodInner> 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 payment Methods for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PaymentMethodInner> 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); + } + + /** + * Lists the payment Methods for a billing profile. The operation is supported only 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 PagedList<PaymentMethodInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the payment Methods for a billing profile. The operation is supported only 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(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the payment Methods for a billing profile. The operation is supported only 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 PagedList<PaymentMethodInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the payment Methods for a billing profile. The operation is supported only 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 PagedList<PaymentMethodInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the payment Methods for a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PaymentMethodInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the payment Methods for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<PaymentMethodInner> 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 payment Methods for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer 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 payment Methods for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<PaymentMethodInner> 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 payment Methods for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<PaymentMethodInner> 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 payment Methods for a billing account. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<PaymentMethodInner> 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 payment Methods for a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<PaymentMethodInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the payment Methods for a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Customer 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> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the payment Methods for a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<PaymentMethodInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the payment Methods for a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<PaymentMethodInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the payment Methods for a billing profile. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<PaymentMethodInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PoliciesImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PoliciesImpl.java new file mode 100644 index 0000000000000..8c6fa7ef80b44 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PoliciesImpl.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Policies; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Policy; +import com.microsoft.azure.management.billing.v2019_10_01_preview.CustomerPolicy; + +class PoliciesImpl extends WrapperImpl implements Policies { + private final BillingManager manager; + + PoliciesImpl(BillingManager manager) { + super(manager.inner().policies()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName) { + PoliciesInner client = this.inner(); + return client.getByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public Policy call(PolicyInner inner) { + return new PolicyImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + PoliciesInner client = this.inner(); + return client.updateAsync(billingAccountName, billingProfileName, parameters) + .map(new Func1() { + @Override + public Policy call(PolicyInner inner) { + return new PolicyImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByCustomerAsync(String billingAccountName, String customerName) { + PoliciesInner client = this.inner(); + return client.getByCustomerAsync(billingAccountName, customerName) + .map(new Func1() { + @Override + public CustomerPolicy call(CustomerPolicyInner inner) { + return new CustomerPolicyImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateCustomerAsync(String billingAccountName, String customerName) { + PoliciesInner client = this.inner(); + return client.updateCustomerAsync(billingAccountName, customerName) + .map(new Func1() { + @Override + public CustomerPolicy call(CustomerPolicyInner inner) { + return new CustomerPolicyImpl(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/PoliciesInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PoliciesInner.java new file mode 100644 index 0000000000000..9b457650942c8 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PoliciesInner.java @@ -0,0 +1,501 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.azure.management.billing.v2019_10_01_preview.ViewCharges; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Policies. + */ +public class PoliciesInner { + /** The Retrofit service to perform REST calls. */ + private PoliciesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of PoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PoliciesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(PoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Policies to be + * used by Retrofit to perform actually REST calls. + */ + interface PoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Policies getByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default") + Observable> getByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Policies update" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default") + Observable> update(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body PolicyInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Policies getByCustomer" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default") + Observable> getByCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Policies updateCustomer" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default") + Observable> updateCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body CustomerPolicyInner parameters, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the policies for a billing profile. This operation is supported only 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 PolicyInner object if successful. + */ + public PolicyInner getByBillingProfile(String billingAccountName, String billingProfileName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists the policies for a billing profile. This operation is supported only 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 getByBillingProfileAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * Lists the policies for a billing profile. This operation is supported only 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 PolicyInner object + */ + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, PolicyInner>() { + @Override + public PolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the policies for a billing profile. This operation is supported only 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 PolicyInner object + */ + public Observable> getByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates the policies for a billing profile. This operation is supported only 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 update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyInner object if successful. + */ + public PolicyInner update(String billingAccountName, String billingProfileName, PolicyInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().single().body(); + } + + /** + * Updates the policies for a billing profile. This operation is supported only 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 update policies operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * Updates the policies for a billing profile. This operation is supported only 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 update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, PolicyInner>() { + @Override + public PolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the policies for a billing profile. This operation is supported only 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 update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(billingAccountName, billingProfileName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 CustomerPolicyInner object if successful. + */ + public CustomerPolicyInner getByCustomer(String billingAccountName, String customerName) { + return getByCustomerWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 getByCustomerAsync(String billingAccountName, String customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByCustomerWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable getByCustomerAsync(String billingAccountName, String customerName) { + return getByCustomerWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, CustomerPolicyInner>() { + @Override + public CustomerPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable> getByCustomerWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByCustomer(billingAccountName, customerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByCustomerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByCustomerDelegate(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); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 CustomerPolicyInner object if successful. + */ + public CustomerPolicyInner updateCustomer(String billingAccountName, String customerName) { + return updateCustomerWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 updateCustomerAsync(String billingAccountName, String customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateCustomerWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable updateCustomerAsync(String billingAccountName, String customerName) { + return updateCustomerWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, CustomerPolicyInner>() { + @Override + public CustomerPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable> updateCustomerWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final ViewCharges viewCharges = null; + CustomerPolicyInner parameters = new CustomerPolicyInner(); + parameters.withViewCharges(null); + return service.updateCustomer(billingAccountName, customerName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateCustomerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param viewCharges The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed' + * @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 CustomerPolicyInner object if successful. + */ + public CustomerPolicyInner updateCustomer(String billingAccountName, String customerName, ViewCharges viewCharges) { + return updateCustomerWithServiceResponseAsync(billingAccountName, customerName, viewCharges).toBlocking().single().body(); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param viewCharges The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed' + * @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 updateCustomerAsync(String billingAccountName, String customerName, ViewCharges viewCharges, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateCustomerWithServiceResponseAsync(billingAccountName, customerName, viewCharges), serviceCallback); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param viewCharges The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable updateCustomerAsync(String billingAccountName, String customerName, ViewCharges viewCharges) { + return updateCustomerWithServiceResponseAsync(billingAccountName, customerName, viewCharges).map(new Func1, CustomerPolicyInner>() { + @Override + public CustomerPolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param viewCharges The policy that controls whether the users in customer's organization can view charges at pay-as-you-go prices. Possible values include: 'Allowed', 'NotAllowed' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerPolicyInner object + */ + public Observable> updateCustomerWithServiceResponseAsync(String billingAccountName, String customerName, ViewCharges viewCharges) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + CustomerPolicyInner parameters = new CustomerPolicyInner(); + parameters.withViewCharges(viewCharges); + return service.updateCustomer(billingAccountName, customerName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateCustomerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateCustomerDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PolicyImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PolicyImpl.java new file mode 100644 index 0000000000000..d911c56c5e0c0 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PolicyImpl.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.Policy; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.MarketplacePurchasesPolicy; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ReservationPurchasesPolicy; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ViewChargesPolicy; + +class PolicyImpl extends WrapperImpl implements Policy { + private final BillingManager manager; + PolicyImpl(PolicyInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public MarketplacePurchasesPolicy marketplacePurchases() { + return this.inner().marketplacePurchases(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ReservationPurchasesPolicy reservationPurchases() { + return this.inner().reservationPurchases(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public ViewChargesPolicy viewCharges() { + return this.inner().viewCharges(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PolicyInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PolicyInner.java new file mode 100644 index 0000000000000..6157f00f021d6 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PolicyInner.java @@ -0,0 +1,106 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.MarketplacePurchasesPolicy; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ReservationPurchasesPolicy; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ViewChargesPolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A policy. + */ +@JsonFlatten +public class PolicyInner extends ProxyResource { + /** + * The policy that controls whether Azure marketplace purchases are allowed + * for a billing profile. Possible values include: 'AllAllowed', + * 'OnlyFreeAllowed', 'NotAllowed'. + */ + @JsonProperty(value = "properties.marketplacePurchases") + private MarketplacePurchasesPolicy marketplacePurchases; + + /** + * The policy that controls whether Azure reservation purchases are allowed + * for a billing profile. Possible values include: 'Allowed', 'NotAllowed'. + */ + @JsonProperty(value = "properties.reservationPurchases") + private ReservationPurchasesPolicy reservationPurchases; + + /** + * The policy that controls whether users with Azure RBAC access to a + * subscription can view its charges. Possible values include: 'Allowed', + * 'NotAllowed'. + */ + @JsonProperty(value = "properties.viewCharges") + private ViewChargesPolicy viewCharges; + + /** + * Get the policy that controls whether Azure marketplace purchases are allowed for a billing profile. Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed'. + * + * @return the marketplacePurchases value + */ + public MarketplacePurchasesPolicy marketplacePurchases() { + return this.marketplacePurchases; + } + + /** + * Set the policy that controls whether Azure marketplace purchases are allowed for a billing profile. Possible values include: 'AllAllowed', 'OnlyFreeAllowed', 'NotAllowed'. + * + * @param marketplacePurchases the marketplacePurchases value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withMarketplacePurchases(MarketplacePurchasesPolicy marketplacePurchases) { + this.marketplacePurchases = marketplacePurchases; + return this; + } + + /** + * Get the policy that controls whether Azure reservation purchases are allowed for a billing profile. Possible values include: 'Allowed', 'NotAllowed'. + * + * @return the reservationPurchases value + */ + public ReservationPurchasesPolicy reservationPurchases() { + return this.reservationPurchases; + } + + /** + * Set the policy that controls whether Azure reservation purchases are allowed for a billing profile. Possible values include: 'Allowed', 'NotAllowed'. + * + * @param reservationPurchases the reservationPurchases value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withReservationPurchases(ReservationPurchasesPolicy reservationPurchases) { + this.reservationPurchases = reservationPurchases; + return this; + } + + /** + * Get the policy that controls whether users with Azure RBAC access to a subscription can view its charges. Possible values include: 'Allowed', 'NotAllowed'. + * + * @return the viewCharges value + */ + public ViewChargesPolicy viewCharges() { + return this.viewCharges; + } + + /** + * Set the policy that controls whether users with Azure RBAC access to a subscription can view its charges. Possible values include: 'Allowed', 'NotAllowed'. + * + * @param viewCharges the viewCharges value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withViewCharges(ViewChargesPolicy viewCharges) { + this.viewCharges = viewCharges; + 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/PriceSheetsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PriceSheetsImpl.java new file mode 100644 index 0000000000000..82ef1000fd76b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PriceSheetsImpl.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.PriceSheets; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.DownloadUrl; + +class PriceSheetsImpl extends WrapperImpl implements PriceSheets { + private final BillingManager manager; + + PriceSheetsImpl(BillingManager manager) { + super(manager.inner().priceSheets()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable downloadAsync(String billingAccountName, String billingProfileName, String invoiceName) { + PriceSheetsInner client = this.inner(); + return client.downloadAsync(billingAccountName, billingProfileName, invoiceName) + .map(new Func1() { + @Override + public DownloadUrl call(DownloadUrlInner inner) { + return new DownloadUrlImpl(inner, manager()); + } + }); + } + + @Override + public Observable downloadByBillingProfileAsync(String billingAccountName, String billingProfileName) { + PriceSheetsInner client = this.inner(); + return client.downloadByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public DownloadUrl call(DownloadUrlInner inner) { + return new DownloadUrlImpl(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/PriceSheetsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PriceSheetsInner.java new file mode 100644 index 0000000000000..8cb550091bc50 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/PriceSheetsInner.java @@ -0,0 +1,390 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.azure.management.billing.v2019_10_01_preview.PriceSheetDownloadByBillingProfileHeaders; +import com.microsoft.azure.management.billing.v2019_10_01_preview.PriceSheetDownloadHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; + +/** + * An instance of this class provides access to all the operations defined + * in PriceSheets. + */ +public class PriceSheetsInner { + /** The Retrofit service to perform REST calls. */ + private PriceSheetsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of PriceSheetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PriceSheetsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(PriceSheetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PriceSheets to be + * used by Retrofit to perform actually REST calls. + */ + interface PriceSheetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.PriceSheets download" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/pricesheet/default/download") + Observable> download(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.PriceSheets beginDownload" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/pricesheet/default/download") + Observable> beginDownload(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.PriceSheets downloadByBillingProfile" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/pricesheet/default/download") + Observable> downloadByBillingProfile(@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.PriceSheets beginDownloadByBillingProfile" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/pricesheet/default/download") + Observable> beginDownloadByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DownloadUrlInner object if successful. + */ + public DownloadUrlInner download(String billingAccountName, String billingProfileName, String invoiceName) { + return downloadWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName).toBlocking().last().body(); + } + + /** + * Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture downloadAsync(String billingAccountName, String billingProfileName, String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(downloadWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName), serviceCallback); + } + + /** + * Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable downloadAsync(String billingAccountName, String billingProfileName, String invoiceName) { + return downloadWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> downloadWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceName) { + 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 (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.download(billingAccountName, billingProfileName, invoiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType(), PriceSheetDownloadHeaders.class); + } + + /** + * Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DownloadUrlInner object if successful. + */ + public DownloadUrlInner beginDownload(String billingAccountName, String billingProfileName, String invoiceName) { + return beginDownloadWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName).toBlocking().single().body(); + } + + /** + * Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDownloadAsync(String billingAccountName, String billingProfileName, String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginDownloadWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName), serviceCallback); + } + + /** + * Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable beginDownloadAsync(String billingAccountName, String billingProfileName, String invoiceName) { + return beginDownloadWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download the pricesheet for an invoice. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable> beginDownloadWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceName) { + 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 (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDownload(billingAccountName, billingProfileName, invoiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginDownloadDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginDownloadDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, PriceSheetDownloadHeaders.class); + } + + /** + * Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 DownloadUrlInner object if successful. + */ + public DownloadUrlInner downloadByBillingProfile(String billingAccountName, String billingProfileName) { + return downloadByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().last().body(); + } + + /** + * Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 downloadByBillingProfileAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(downloadByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 for the request + */ + public Observable downloadByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return downloadByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 for the request + */ + public Observable> downloadByBillingProfileWithServiceResponseAsync(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."); + } + Observable> observable = service.downloadByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType(), PriceSheetDownloadByBillingProfileHeaders.class); + } + + /** + * Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 DownloadUrlInner object if successful. + */ + public DownloadUrlInner beginDownloadByBillingProfile(String billingAccountName, String billingProfileName) { + return beginDownloadByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 beginDownloadByBillingProfileAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginDownloadByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 DownloadUrlInner object + */ + public Observable beginDownloadByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return beginDownloadByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Gets a URL to download the current month's pricesheet for a billing profile. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or 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 DownloadUrlInner object + */ + public Observable> beginDownloadByBillingProfileWithServiceResponseAsync(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.beginDownloadByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginDownloadByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginDownloadByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, PriceSheetDownloadByBillingProfileHeaders.class); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductImpl.java new file mode 100644 index 0000000000000..f1ee04eecb35b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductImpl.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.Product; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingFrequency; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Amount; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Reseller; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ProductStatusType; + +class ProductImpl extends IndexableRefreshableWrapperImpl implements Product { + private final BillingManager manager; + private String billingAccountName; + private String customerName; + private String productName; + + ProductImpl(ProductInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.customerName = IdParsingUtils.getValueFromIdByName(inner.id(), "customers"); + this.productName = IdParsingUtils.getValueFromIdByName(inner.id(), "products"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ProductsInner client = this.manager().inner().products(); + return client.getByCustomerAsync(this.billingAccountName, this.customerName, this.productName); + } + + + + @Override + public String availabilityId() { + return this.inner().availabilityId(); + } + + @Override + public BillingFrequency billingFrequency() { + return this.inner().billingFrequency(); + } + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String customerDisplayName() { + return this.inner().customerDisplayName(); + } + + @Override + public String customerId() { + return this.inner().customerId(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoiceSectionDisplayName() { + return this.inner().invoiceSectionDisplayName(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public Amount lastCharge() { + return this.inner().lastCharge(); + } + + @Override + public DateTime lastChargeDate() { + return this.inner().lastChargeDate(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String parentProductId() { + return this.inner().parentProductId(); + } + + @Override + public String productType() { + return this.inner().productType(); + } + + @Override + public String productTypeId() { + return this.inner().productTypeId(); + } + + @Override + public DateTime purchaseDate() { + return this.inner().purchaseDate(); + } + + @Override + public Double quantity() { + return this.inner().quantity(); + } + + @Override + public Reseller reseller() { + return this.inner().reseller(); + } + + @Override + public String skuDescription() { + return this.inner().skuDescription(); + } + + @Override + public String skuId() { + return this.inner().skuId(); + } + + @Override + public ProductStatusType status() { + return this.inner().status(); + } + + @Override + public String tenantId() { + return this.inner().tenantId(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductInner.java new file mode 100644 index 0000000000000..f35b892a49b75 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductInner.java @@ -0,0 +1,382 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ProductStatusType; +import com.microsoft.azure.management.billing.v2019_10_01_preview.BillingFrequency; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Amount; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Reseller; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A product. + */ +@JsonFlatten +public class ProductInner extends ProxyResource { + /** + * The display name of the product. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The date when the product was purchased. + */ + @JsonProperty(value = "properties.purchaseDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime purchaseDate; + + /** + * The ID of the type of product. + */ + @JsonProperty(value = "properties.productTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String productTypeId; + + /** + * The description of the type of product. + */ + @JsonProperty(value = "properties.productType", access = JsonProperty.Access.WRITE_ONLY) + private String productType; + + /** + * The current status of the product. Possible values include: 'Active', + * 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', + * 'AutoRenew'. + */ + @JsonProperty(value = "properties.status") + private ProductStatusType status; + + /** + * The date when the product will be renewed or canceled. + */ + @JsonProperty(value = "properties.endDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endDate; + + /** + * The frequency at which the product will be billed. Possible values + * include: 'OneTime', 'Monthly', 'UsageBased'. + */ + @JsonProperty(value = "properties.billingFrequency") + private BillingFrequency billingFrequency; + + /** + * The last month charges. + */ + @JsonProperty(value = "properties.lastCharge", access = JsonProperty.Access.WRITE_ONLY) + private Amount lastCharge; + + /** + * The date of the last charge. + */ + @JsonProperty(value = "properties.lastChargeDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastChargeDate; + + /** + * The quantity purchased for the product. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private Double quantity; + + /** + * The sku ID of the product. + */ + @JsonProperty(value = "properties.skuId", access = JsonProperty.Access.WRITE_ONLY) + private String skuId; + + /** + * The sku description of the product. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * The id of the tenant in which the product is used. + */ + @JsonProperty(value = "properties.tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The availability of the product. + */ + @JsonProperty(value = "properties.availabilityId", access = JsonProperty.Access.WRITE_ONLY) + private String availabilityId; + + /** + * Parent product Id. + */ + @JsonProperty(value = "properties.parentProductId", access = JsonProperty.Access.WRITE_ONLY) + private String parentProductId; + + /** + * The ID of the invoice section to which the product is billed. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * The name of the invoice section to which the product is billed. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /** + * The ID of the billing profile to which the product is billed. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile to which the product is billed. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * The ID of the customer for whom the product was purchased. The field is + * applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * The name of the customer for whom the product was purchased. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + + /** + * Reseller for this product. + */ + @JsonProperty(value = "properties.reseller", access = JsonProperty.Access.WRITE_ONLY) + private Reseller reseller; + + /** + * Get the display name of the product. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the date when the product was purchased. + * + * @return the purchaseDate value + */ + public DateTime purchaseDate() { + return this.purchaseDate; + } + + /** + * Get the ID of the type of product. + * + * @return the productTypeId value + */ + public String productTypeId() { + return this.productTypeId; + } + + /** + * Get the description of the type of product. + * + * @return the productType value + */ + public String productType() { + return this.productType; + } + + /** + * Get the current status of the product. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew'. + * + * @return the status value + */ + public ProductStatusType status() { + return this.status; + } + + /** + * Set the current status of the product. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew'. + * + * @param status the status value to set + * @return the ProductInner object itself. + */ + public ProductInner withStatus(ProductStatusType status) { + this.status = status; + return this; + } + + /** + * Get the date when the product will be renewed or canceled. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Get the frequency at which the product will be billed. Possible values include: 'OneTime', 'Monthly', 'UsageBased'. + * + * @return the billingFrequency value + */ + public BillingFrequency billingFrequency() { + return this.billingFrequency; + } + + /** + * Set the frequency at which the product will be billed. Possible values include: 'OneTime', 'Monthly', 'UsageBased'. + * + * @param billingFrequency the billingFrequency value to set + * @return the ProductInner object itself. + */ + public ProductInner withBillingFrequency(BillingFrequency billingFrequency) { + this.billingFrequency = billingFrequency; + return this; + } + + /** + * Get the last month charges. + * + * @return the lastCharge value + */ + public Amount lastCharge() { + return this.lastCharge; + } + + /** + * Get the date of the last charge. + * + * @return the lastChargeDate value + */ + public DateTime lastChargeDate() { + return this.lastChargeDate; + } + + /** + * Get the quantity purchased for the product. + * + * @return the quantity value + */ + public Double quantity() { + return this.quantity; + } + + /** + * Get the sku ID of the product. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Get the sku description of the product. + * + * @return the skuDescription value + */ + public String skuDescription() { + return this.skuDescription; + } + + /** + * Get the id of the tenant in which the product is used. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the availability of the product. + * + * @return the availabilityId value + */ + public String availabilityId() { + return this.availabilityId; + } + + /** + * Get parent product Id. + * + * @return the parentProductId value + */ + public String parentProductId() { + return this.parentProductId; + } + + /** + * Get the ID of the invoice section to which the product is billed. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the name of the invoice section to which the product is billed. + * + * @return the invoiceSectionDisplayName value + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the ID of the billing profile to which the product is billed. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile to which the product is billed. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the ID of the customer for whom the product was purchased. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the name of the customer for whom the product was purchased. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + + /** + * Get reseller for this product. + * + * @return the reseller value + */ + public Reseller reseller() { + return this.reseller; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsImpl.java new file mode 100644 index 0000000000000..bb1edf386e481 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsImpl.java @@ -0,0 +1,145 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.Products; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ProductsListResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Product; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ValidateProductTransferEligibilityResult; +import com.microsoft.azure.management.billing.v2019_10_01_preview.UpdateAutoRenewOperation; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransferProductRequestProperties; + +class ProductsImpl extends WrapperImpl implements Products { + private final BillingManager manager; + + ProductsImpl(BillingManager manager) { + super(manager.inner().products()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private ProductImpl wrapModel(ProductInner inner) { + return new ProductImpl(inner, manager()); + } + + @Override + public Observable listByCustomerAsync(String billingAccountName, String customerName) { + ProductsInner client = this.inner(); + return client.listByCustomerAsync(billingAccountName, customerName) + .map(new Func1() { + @Override + public ProductsListResult call(ProductsListResultInner inner) { + return new ProductsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName) { + ProductsInner 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 Product call(ProductInner inner) { + return new ProductImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + ProductsInner client = this.inner(); + return client.listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName) + .map(new Func1() { + @Override + public ProductsListResult call(ProductsListResultInner inner) { + return new ProductsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName) { + ProductsInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName, invoiceSectionName, productName) + .map(new Func1() { + @Override + public Product call(ProductInner inner) { + return new ProductImpl(inner, manager()); + } + }); + } + + @Override + public Observable transferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + ProductsInner client = this.inner(); + return client.transferAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters) + .map(new Func1() { + @Override + public Product call(ProductInner inner) { + return new ProductImpl(inner, manager()); + } + }); + } + + @Override + public Observable validateTransferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + ProductsInner client = this.inner(); + return client.validateTransferAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters) + .map(new Func1() { + @Override + public ValidateProductTransferEligibilityResult call(ValidateProductTransferEligibilityResultInner inner) { + return new ValidateProductTransferEligibilityResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAutoRenewByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName) { + ProductsInner client = this.inner(); + return client.updateAutoRenewByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, productName) + .map(new Func1() { + @Override + public UpdateAutoRenewOperation call(UpdateAutoRenewOperationInner inner) { + return new UpdateAutoRenewOperationImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByCustomerAsync(String billingAccountName, String customerName, String productName) { + ProductsInner client = this.inner(); + return client.getByCustomerAsync(billingAccountName, customerName, productName) + .flatMap(new Func1>() { + @Override + public Observable call(ProductInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Product)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/ProductsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsInner.java new file mode 100644 index 0000000000000..d66e92e9b878e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsInner.java @@ -0,0 +1,1373 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ProductsTransferHeaders; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransferProductRequestProperties; +import com.microsoft.azure.management.billing.v2019_10_01_preview.UpdateAutoRenew; +import com.microsoft.azure.management.billing.v2019_10_01_preview.UpdateAutoRenewRequest; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Products. + */ +public class ProductsInner { + /** The Retrofit service to perform REST calls. */ + private ProductsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of ProductsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProductsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(ProductsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Products to be + * used by Retrofit to perform actually REST calls. + */ + interface ProductsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Products listByCustomer" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products") + Observable> listByCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Products getByCustomer" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products/{productName}") + Observable> getByCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Path("productName") String productName, @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.Products listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Products listByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products") + Observable> listByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Products get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("productName") String productName, @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.Products transfer" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/transfer") + Observable> transfer(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Body TransferProductRequestProperties 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.Products validateTransfer" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/validateTransferEligibility") + Observable> validateTransfer(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("productName") String productName, @Body TransferProductRequestProperties 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.Products updateAutoRenewByInvoiceSection" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew") + Observable> updateAutoRenewByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UpdateAutoRenewRequest body, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Products listByBillingAccountNext" }) + @GET + Observable> listByBillingAccountNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProductsListResultInner object if successful. + */ + public ProductsListResultInner listByCustomer(String billingAccountName, String customerName) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @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 listByCustomerAsync(String billingAccountName, String customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByCustomerWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductsListResultInner object + */ + public Observable listByCustomerAsync(String billingAccountName, String customerName) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, ProductsListResultInner>() { + @Override + public ProductsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductsListResultInner object + */ + public Observable> listByCustomerWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listByCustomer(billingAccountName, customerName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByCustomerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProductsListResultInner object if successful. + */ + public ProductsListResultInner listByCustomer(String billingAccountName, String customerName, String filter) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName, filter).toBlocking().single().body(); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByCustomerAsync(String billingAccountName, String customerName, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByCustomerWithServiceResponseAsync(billingAccountName, customerName, filter), serviceCallback); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductsListResultInner object + */ + public Observable listByCustomerAsync(String billingAccountName, String customerName, String filter) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName, filter).map(new Func1, ProductsListResultInner>() { + @Override + public ProductsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductsListResultInner object + */ + public Observable> listByCustomerWithServiceResponseAsync(String billingAccountName, String customerName, String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByCustomer(billingAccountName, customerName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByCustomerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByCustomerDelegate(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 a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param productName The ID that uniquely identifies a product. + * @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 ProductInner object if successful. + */ + public ProductInner getByCustomer(String billingAccountName, String customerName, String productName) { + return getByCustomerWithServiceResponseAsync(billingAccountName, customerName, productName).toBlocking().single().body(); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param productName The ID that uniquely identifies a product. + * @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 getByCustomerAsync(String billingAccountName, String customerName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByCustomerWithServiceResponseAsync(billingAccountName, customerName, productName), serviceCallback); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable getByCustomerAsync(String billingAccountName, String customerName, String productName) { + return getByCustomerWithServiceResponseAsync(billingAccountName, customerName, productName).map(new Func1, ProductInner>() { + @Override + public ProductInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable> getByCustomerWithServiceResponseAsync(String billingAccountName, String customerName, String productName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByCustomer(billingAccountName, customerName, productName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByCustomerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByCustomerDelegate(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 products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<ProductInner> 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 products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<ProductInner> 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 products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<ProductInner> 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 products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> 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."); + } + final String filter = null; + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), filter, 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); + } + } + }); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProductInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName, final String filter) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountAsync(final String billingAccountName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName, final String filter) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName, final String filter) { + return listByBillingAccountSinglePageAsync(billingAccountName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), filter, 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); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only 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 ProductsListResultInner object if successful. + */ + public ProductsListResultInner listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only 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 products for an invoice section. These don't include products billed based on usage. The operation is supported only 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 ProductsListResultInner object + */ + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName).map(new Func1, ProductsListResultInner>() { + @Override + public ProductsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only 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 ProductsListResultInner 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."); + } + final String filter = null; + return service.listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), filter, 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); + } + } + }); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only 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 filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProductsListResultInner object if successful. + */ + public ProductsListResultInner listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String filter) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, filter).toBlocking().single().body(); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only 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 filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, filter), serviceCallback); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only 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 filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductsListResultInner object + */ + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String filter) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, filter).map(new Func1, ProductsListResultInner>() { + @Override + public ProductsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is supported only 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 filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductsListResultInner object + */ + public Observable> listByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (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(), filter, 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); + } + + /** + * Gets a product by ID. The operation is supported only 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 productName The ID that uniquely identifies a product. + * @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 ProductInner object if successful. + */ + public ProductInner get(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName).toBlocking().single().body(); + } + + /** + * Gets a product by ID. The operation is supported only 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 productName The ID that uniquely identifies a product. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName), serviceCallback); + } + + /** + * Gets a product by ID. The operation is supported only 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 productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName).map(new Func1, ProductInner>() { + @Override + public ProductInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a product by ID. The operation is supported only 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 productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName) { + 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 (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, billingProfileName, invoiceSectionName, productName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the transfer product 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 ProductInner object if successful. + */ + public ProductInner transfer(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + return transferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters).toBlocking().single().body(); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the transfer product operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture transferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(transferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters), serviceCallback); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the transfer product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable transferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + return transferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters).map(new Func1, ProductInner>() { + @Override + public ProductInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing profile as the existing invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the transfer product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductInner object + */ + public Observable> transferWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties 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 (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.transfer(billingAccountName, billingProfileName, invoiceSectionName, productName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = transferDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders transferDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, ProductsTransferHeaders.class); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate transfer eligibility 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 ValidateProductTransferEligibilityResultInner object if successful. + */ + public ValidateProductTransferEligibilityResultInner validateTransfer(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + return validateTransferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters).toBlocking().single().body(); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate transfer eligibility 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 validateTransferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateTransferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters), serviceCallback); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate transfer eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateProductTransferEligibilityResultInner object + */ + public Observable validateTransferAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + return validateTransferWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters).map(new Func1, ValidateProductTransferEligibilityResultInner>() { + @Override + public ValidateProductTransferEligibilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for products that are purchased with a recurring charge and 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 productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate transfer eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateProductTransferEligibilityResultInner object + */ + public Observable> validateTransferWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, TransferProductRequestProperties 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 (productName == null) { + throw new IllegalArgumentException("Parameter productName 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.validateTransfer(billingAccountName, billingProfileName, invoiceSectionName, productName, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateTransferDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateTransferDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName 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 productName The ID that uniquely identifies a product. + * @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 UpdateAutoRenewOperationInner object if successful. + */ + public UpdateAutoRenewOperationInner updateAutoRenewByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName) { + return updateAutoRenewByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName).toBlocking().single().body(); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @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 productName The ID that uniquely identifies a product. + * @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 updateAutoRenewByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateAutoRenewByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName), serviceCallback); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @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 productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationInner object + */ + public Observable updateAutoRenewByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName) { + return updateAutoRenewByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName).map(new Func1, UpdateAutoRenewOperationInner>() { + @Override + public UpdateAutoRenewOperationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @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 productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationInner object + */ + public Observable> updateAutoRenewByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName) { + 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 (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final UpdateAutoRenew autoRenew = null; + UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); + body.withAutoRenew(null); + return service.updateAutoRenewByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, productName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateAutoRenewByInvoiceSectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName 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 productName The ID that uniquely identifies a product. + * @param autoRenew The flag that determines the auto-renew settings for a product. Possible values include: 'true', 'false' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UpdateAutoRenewOperationInner object if successful. + */ + public UpdateAutoRenewOperationInner updateAutoRenewByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { + return updateAutoRenewByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, autoRenew).toBlocking().single().body(); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @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 productName The ID that uniquely identifies a product. + * @param autoRenew The flag that determines the auto-renew settings for a product. Possible values include: 'true', 'false' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAutoRenewByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateAutoRenewByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, autoRenew), serviceCallback); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @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 productName The ID that uniquely identifies a product. + * @param autoRenew The flag that determines the auto-renew settings for a product. Possible values include: 'true', 'false' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationInner object + */ + public Observable updateAutoRenewByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { + return updateAutoRenewByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, productName, autoRenew).map(new Func1, UpdateAutoRenewOperationInner>() { + @Override + public UpdateAutoRenewOperationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @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 productName The ID that uniquely identifies a product. + * @param autoRenew The flag that determines the auto-renew settings for a product. Possible values include: 'true', 'false' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationInner object + */ + public Observable> updateAutoRenewByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { + 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 (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); + body.withAutoRenew(autoRenew); + return service.updateAutoRenewByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, productName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateAutoRenewByInvoiceSectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateAutoRenewByInvoiceSectionDelegate(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 products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<ProductInner> 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 products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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 products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<ProductInner> 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 products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<ProductInner> 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 products for a billing account. These don't include products billed based on usage. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner 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<ProductInner> 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); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsListResultImpl.java new file mode 100644 index 0000000000000..73551f9b3cf55 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsListResultImpl.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.ProductsListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class ProductsListResultImpl extends WrapperImpl implements ProductsListResult { + private final BillingManager manager; + ProductsListResultImpl(ProductsListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsListResultInner.java new file mode 100644 index 0000000000000..fb59f312e246a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ProductsListResultInner.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 list of products. It contains a list of available product summaries in + * reverse chronological order by purchase date. + */ +public class ProductsListResultInner { + /** + * The list of products. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of products. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransferDetailsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransferDetailsImpl.java new file mode 100644 index 0000000000000..4df6e60115769 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransferDetailsImpl.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.RecipientTransferDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.EligibleProductType; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2019_10_01_preview.DetailedTransferStatus; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransferStatus; + +class RecipientTransferDetailsImpl extends WrapperImpl implements RecipientTransferDetails { + private final BillingManager manager; + RecipientTransferDetailsImpl(RecipientTransferDetailsInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public List allowedProductType() { + return this.inner().allowedProductType(); + } + + @Override + public String canceledBy() { + return this.inner().canceledBy(); + } + + @Override + public DateTime creationTime() { + return this.inner().creationTime(); + } + + @Override + public List detailedTransferStatus() { + return this.inner().detailedTransferStatus(); + } + + @Override + public DateTime expirationTime() { + return this.inner().expirationTime(); + } + + @Override + public String initiatorCustomerType() { + return this.inner().initiatorCustomerType(); + } + + @Override + public String initiatorEmailId() { + return this.inner().initiatorEmailId(); + } + + @Override + public DateTime lastModifiedTime() { + return this.inner().lastModifiedTime(); + } + + @Override + public String recipientEmailId() { + return this.inner().recipientEmailId(); + } + + @Override + public String resellerId() { + return this.inner().resellerId(); + } + + @Override + public String resellerName() { + return this.inner().resellerName(); + } + + @Override + public TransferStatus transferStatus() { + return this.inner().transferStatus(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransferDetailsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransferDetailsInner.java new file mode 100644 index 0000000000000..09df5625b718e --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransferDetailsInner.java @@ -0,0 +1,208 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.EligibleProductType; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransferStatus; +import com.microsoft.azure.management.billing.v2019_10_01_preview.DetailedTransferStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Details of the transfer. + */ +@JsonFlatten +public class RecipientTransferDetailsInner { + /** + * The time at which the transfer request was created. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationTime; + + /** + * The time at which the transfer request expires. + */ + @JsonProperty(value = "properties.expirationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expirationTime; + + /** + * Type of subscriptions that can be transferred. + */ + @JsonProperty(value = "properties.allowedProductType", access = JsonProperty.Access.WRITE_ONLY) + private List allowedProductType; + + /** + * Overall transfer status. Possible values include: 'Pending', + * 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', 'Canceled', + * 'Declined'. + */ + @JsonProperty(value = "properties.transferStatus", access = JsonProperty.Access.WRITE_ONLY) + private TransferStatus transferStatus; + + /** + * The email ID of the user to whom the transfer request was sent. + */ + @JsonProperty(value = "properties.recipientEmailId", access = JsonProperty.Access.WRITE_ONLY) + private String recipientEmailId; + + /** + * The email ID of the user who sent the transfer request. + */ + @JsonProperty(value = "properties.initiatorEmailId", access = JsonProperty.Access.WRITE_ONLY) + private String initiatorEmailId; + + /** + * Optional MPN ID of the reseller for transfer requests that are sent from + * a Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.resellerId", access = JsonProperty.Access.WRITE_ONLY) + private String resellerId; + + /** + * Optional name of the reseller for transfer requests that are sent from + * Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.resellerName", access = JsonProperty.Access.WRITE_ONLY) + private String resellerName; + + /** + * The type of customer who sent the transfer request. + */ + @JsonProperty(value = "properties.initiatorCustomerType", access = JsonProperty.Access.WRITE_ONLY) + private String initiatorCustomerType; + + /** + * The email ID of the user who canceled the transfer request. + */ + @JsonProperty(value = "properties.canceledBy", access = JsonProperty.Access.WRITE_ONLY) + private String canceledBy; + + /** + * The time at which the transfer request was last modified. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastModifiedTime; + + /** + * Detailed transfer status. + */ + @JsonProperty(value = "properties.detailedTransferStatus", access = JsonProperty.Access.WRITE_ONLY) + private List detailedTransferStatus; + + /** + * Get the time at which the transfer request was created. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + + /** + * Get the time at which the transfer request expires. + * + * @return the expirationTime value + */ + public DateTime expirationTime() { + return this.expirationTime; + } + + /** + * Get type of subscriptions that can be transferred. + * + * @return the allowedProductType value + */ + public List allowedProductType() { + return this.allowedProductType; + } + + /** + * Get overall transfer status. Possible values include: 'Pending', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', 'Canceled', 'Declined'. + * + * @return the transferStatus value + */ + public TransferStatus transferStatus() { + return this.transferStatus; + } + + /** + * Get the email ID of the user to whom the transfer request was sent. + * + * @return the recipientEmailId value + */ + public String recipientEmailId() { + return this.recipientEmailId; + } + + /** + * Get the email ID of the user who sent the transfer request. + * + * @return the initiatorEmailId value + */ + public String initiatorEmailId() { + return this.initiatorEmailId; + } + + /** + * Get optional MPN ID of the reseller for transfer requests that are sent from a Microsoft Partner Agreement billing account. + * + * @return the resellerId value + */ + public String resellerId() { + return this.resellerId; + } + + /** + * Get optional name of the reseller for transfer requests that are sent from Microsoft Partner Agreement billing account. + * + * @return the resellerName value + */ + public String resellerName() { + return this.resellerName; + } + + /** + * Get the type of customer who sent the transfer request. + * + * @return the initiatorCustomerType value + */ + public String initiatorCustomerType() { + return this.initiatorCustomerType; + } + + /** + * Get the email ID of the user who canceled the transfer request. + * + * @return the canceledBy value + */ + public String canceledBy() { + return this.canceledBy; + } + + /** + * Get the time at which the transfer request was last modified. + * + * @return the lastModifiedTime value + */ + public DateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get detailed transfer status. + * + * @return the detailedTransferStatus value + */ + public List detailedTransferStatus() { + return this.detailedTransferStatus; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersImpl.java new file mode 100644 index 0000000000000..c189864fb1a6b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersImpl.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.RecipientTransfers; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.RecipientTransferDetails; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ValidateTransferListResponse; + +class RecipientTransfersImpl extends WrapperImpl implements RecipientTransfers { + private final BillingManager manager; + + RecipientTransfersImpl(BillingManager manager) { + super(manager.inner().recipientTransfers()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable acceptAsync(String transferName) { + RecipientTransfersInner client = this.inner(); + return client.acceptAsync(transferName) + .map(new Func1() { + @Override + public RecipientTransferDetails call(RecipientTransferDetailsInner inner) { + return new RecipientTransferDetailsImpl(inner, manager()); + } + }); + } + + @Override + public Observable validateAsync(String transferName) { + RecipientTransfersInner client = this.inner(); + return client.validateAsync(transferName) + .map(new Func1() { + @Override + public ValidateTransferListResponse call(ValidateTransferListResponseInner inner) { + return new ValidateTransferListResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable declineAsync(String transferName) { + RecipientTransfersInner client = this.inner(); + return client.declineAsync(transferName) + .map(new Func1() { + @Override + public RecipientTransferDetails call(RecipientTransferDetailsInner inner) { + return new RecipientTransferDetailsImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String transferName) { + RecipientTransfersInner client = this.inner(); + return client.getAsync(transferName) + .map(new Func1() { + @Override + public RecipientTransferDetails call(RecipientTransferDetailsInner inner) { + return new RecipientTransferDetailsImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync() { + RecipientTransfersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public RecipientTransferDetails call(RecipientTransferDetailsInner inner) { + return new RecipientTransferDetailsImpl(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/RecipientTransfersInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersInner.java new file mode 100644 index 0000000000000..8a4cf131b3dfc --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/RecipientTransfersInner.java @@ -0,0 +1,746 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AcceptTransferRequest; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ProductDetails; +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; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in RecipientTransfers. + */ +public class RecipientTransfersInner { + /** The Retrofit service to perform REST calls. */ + private RecipientTransfersService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of RecipientTransfersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public RecipientTransfersInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(RecipientTransfersService.class); + this.client = client; + } + + /** + * The interface defining all the services for RecipientTransfers to be + * used by Retrofit to perform actually REST calls. + */ + interface RecipientTransfersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.RecipientTransfers accept" }) + @POST("providers/Microsoft.Billing/transfers/{transferName}/acceptTransfer") + Observable> accept(@Path("transferName") String transferName, @Header("accept-language") String acceptLanguage, @Body AcceptTransferRequest parameters, @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.RecipientTransfers validate" }) + @POST("providers/Microsoft.Billing/transfers/{transferName}/validateTransfer") + Observable> validate(@Path("transferName") String transferName, @Header("accept-language") String acceptLanguage, @Body AcceptTransferRequest parameters, @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.RecipientTransfers decline" }) + @POST("providers/Microsoft.Billing/transfers/{transferName}/declineTransfer") + Observable> decline(@Path("transferName") String transferName, @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.RecipientTransfers get" }) + @GET("providers/Microsoft.Billing/transfers/{transferName}") + Observable> get(@Path("transferName") String transferName, @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.RecipientTransfers list" }) + @GET("providers/Microsoft.Billing/transfers") + Observable> list(@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.RecipientTransfers listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Accepts a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @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 RecipientTransferDetailsInner object if successful. + */ + public RecipientTransferDetailsInner accept(String transferName) { + return acceptWithServiceResponseAsync(transferName).toBlocking().single().body(); + } + + /** + * Accepts a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @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 acceptAsync(String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(acceptWithServiceResponseAsync(transferName), serviceCallback); + } + + /** + * Accepts a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientTransferDetailsInner object + */ + public Observable acceptAsync(String transferName) { + return acceptWithServiceResponseAsync(transferName).map(new Func1, RecipientTransferDetailsInner>() { + @Override + public RecipientTransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Accepts a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientTransferDetailsInner object + */ + public Observable> acceptWithServiceResponseAsync(String transferName) { + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + final List productDetails = null; + AcceptTransferRequest parameters = new AcceptTransferRequest(); + parameters.withProductDetails(null); + return service.accept(transferName, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = acceptDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Accepts a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @param productDetails Request parameters to accept transfer. + * @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 RecipientTransferDetailsInner object if successful. + */ + public RecipientTransferDetailsInner accept(String transferName, List productDetails) { + return acceptWithServiceResponseAsync(transferName, productDetails).toBlocking().single().body(); + } + + /** + * Accepts a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @param productDetails Request parameters to accept transfer. + * @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 acceptAsync(String transferName, List productDetails, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(acceptWithServiceResponseAsync(transferName, productDetails), serviceCallback); + } + + /** + * Accepts a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @param productDetails Request parameters to accept transfer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientTransferDetailsInner object + */ + public Observable acceptAsync(String transferName, List productDetails) { + return acceptWithServiceResponseAsync(transferName, productDetails).map(new Func1, RecipientTransferDetailsInner>() { + @Override + public RecipientTransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Accepts a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @param productDetails Request parameters to accept transfer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientTransferDetailsInner object + */ + public Observable> acceptWithServiceResponseAsync(String transferName, List productDetails) { + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + Validator.validate(productDetails); + AcceptTransferRequest parameters = new AcceptTransferRequest(); + parameters.withProductDetails(productDetails); + return service.accept(transferName, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = acceptDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse acceptDelegate(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); + } + + /** + * Validates if a subscription or a reservation can be transferred. Use this operation to validate your subscriptions or reservation before using the accept transfer operation. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @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 ValidateTransferListResponseInner object if successful. + */ + public ValidateTransferListResponseInner validate(String transferName) { + return validateWithServiceResponseAsync(transferName).toBlocking().single().body(); + } + + /** + * Validates if a subscription or a reservation can be transferred. Use this operation to validate your subscriptions or reservation before using the accept transfer operation. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @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 validateAsync(String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateWithServiceResponseAsync(transferName), serviceCallback); + } + + /** + * Validates if a subscription or a reservation can be transferred. Use this operation to validate your subscriptions or reservation before using the accept transfer operation. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateTransferListResponseInner object + */ + public Observable validateAsync(String transferName) { + return validateWithServiceResponseAsync(transferName).map(new Func1, ValidateTransferListResponseInner>() { + @Override + public ValidateTransferListResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates if a subscription or a reservation can be transferred. Use this operation to validate your subscriptions or reservation before using the accept transfer operation. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateTransferListResponseInner object + */ + public Observable> validateWithServiceResponseAsync(String transferName) { + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + final List productDetails = null; + AcceptTransferRequest parameters = new AcceptTransferRequest(); + parameters.withProductDetails(null); + return service.validate(transferName, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Validates if a subscription or a reservation can be transferred. Use this operation to validate your subscriptions or reservation before using the accept transfer operation. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @param productDetails Request parameters to accept transfer. + * @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 ValidateTransferListResponseInner object if successful. + */ + public ValidateTransferListResponseInner validate(String transferName, List productDetails) { + return validateWithServiceResponseAsync(transferName, productDetails).toBlocking().single().body(); + } + + /** + * Validates if a subscription or a reservation can be transferred. Use this operation to validate your subscriptions or reservation before using the accept transfer operation. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @param productDetails Request parameters to accept transfer. + * @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 validateAsync(String transferName, List productDetails, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateWithServiceResponseAsync(transferName, productDetails), serviceCallback); + } + + /** + * Validates if a subscription or a reservation can be transferred. Use this operation to validate your subscriptions or reservation before using the accept transfer operation. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @param productDetails Request parameters to accept transfer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateTransferListResponseInner object + */ + public Observable validateAsync(String transferName, List productDetails) { + return validateWithServiceResponseAsync(transferName, productDetails).map(new Func1, ValidateTransferListResponseInner>() { + @Override + public ValidateTransferListResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates if a subscription or a reservation can be transferred. Use this operation to validate your subscriptions or reservation before using the accept transfer operation. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @param productDetails Request parameters to accept transfer. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateTransferListResponseInner object + */ + public Observable> validateWithServiceResponseAsync(String transferName, List productDetails) { + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + Validator.validate(productDetails); + AcceptTransferRequest parameters = new AcceptTransferRequest(); + parameters.withProductDetails(productDetails); + return service.validate(transferName, this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = validateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse validateDelegate(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); + } + + /** + * Declines a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @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 RecipientTransferDetailsInner object if successful. + */ + public RecipientTransferDetailsInner decline(String transferName) { + return declineWithServiceResponseAsync(transferName).toBlocking().single().body(); + } + + /** + * Declines a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @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 declineAsync(String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(declineWithServiceResponseAsync(transferName), serviceCallback); + } + + /** + * Declines a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientTransferDetailsInner object + */ + public Observable declineAsync(String transferName) { + return declineWithServiceResponseAsync(transferName).map(new Func1, RecipientTransferDetailsInner>() { + @Override + public RecipientTransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Declines a transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientTransferDetailsInner object + */ + public Observable> declineWithServiceResponseAsync(String transferName) { + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + return service.decline(transferName, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = declineDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse declineDelegate(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 a transfer request by ID. The caller must be the recipient of the transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @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 RecipientTransferDetailsInner object if successful. + */ + public RecipientTransferDetailsInner get(String transferName) { + return getWithServiceResponseAsync(transferName).toBlocking().single().body(); + } + + /** + * Gets a transfer request by ID. The caller must be the recipient of the transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(transferName), serviceCallback); + } + + /** + * Gets a transfer request by ID. The caller must be the recipient of the transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientTransferDetailsInner object + */ + public Observable getAsync(String transferName) { + return getWithServiceResponseAsync(transferName).map(new Func1, RecipientTransferDetailsInner>() { + @Override + public RecipientTransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a transfer request by ID. The caller must be the recipient of the transfer request. + * + * @param transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the RecipientTransferDetailsInner object + */ + public Observable> getWithServiceResponseAsync(String transferName) { + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + return service.get(transferName, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transfer requests received by the caller. + * + * @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<RecipientTransferDetailsInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transfer requests received by the caller. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transfer requests received by the caller. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecipientTransferDetailsInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transfer requests received by the caller. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecipientTransferDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transfer requests received by the caller. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RecipientTransferDetailsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + return service.list(this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transfer requests received by the caller. + * + * @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<RecipientTransferDetailsInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transfer requests received by the caller. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transfer requests received by the caller. + * + * @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<RecipientTransferDetailsInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transfer requests received by the caller. + * + * @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<RecipientTransferDetailsInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transfer requests received by the caller. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RecipientTransferDetailsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionImpl.java new file mode 100644 index 0000000000000..f7e34205ad5c4 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionImpl.java @@ -0,0 +1,219 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.Transaction; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Amount; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransactionTypeKind; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ReservationType; + +class TransactionImpl extends WrapperImpl implements Transaction { + private final BillingManager manager; + + TransactionImpl(TransactionInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public Amount azureCreditApplied() { + return this.inner().azureCreditApplied(); + } + + @Override + public String billingCurrency() { + return this.inner().billingCurrency(); + } + + @Override + public String billingProfileDisplayName() { + return this.inner().billingProfileDisplayName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String customerDisplayName() { + return this.inner().customerDisplayName(); + } + + @Override + public String customerId() { + return this.inner().customerId(); + } + + @Override + public DateTime dateProperty() { + return this.inner().dateProperty(); + } + + @Override + public Double discount() { + return this.inner().discount(); + } + + @Override + public Amount effectivePrice() { + return this.inner().effectivePrice(); + } + + @Override + public Double exchangeRate() { + return this.inner().exchangeRate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoice() { + return this.inner().invoice(); + } + + @Override + public String invoiceSectionDisplayName() { + return this.inner().invoiceSectionDisplayName(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public TransactionTypeKind kind() { + return this.inner().kind(); + } + + @Override + public Amount marketPrice() { + return this.inner().marketPrice(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String orderId() { + return this.inner().orderId(); + } + + @Override + public String orderName() { + return this.inner().orderName(); + } + + @Override + public String pricingCurrency() { + return this.inner().pricingCurrency(); + } + + @Override + public String productDescription() { + return this.inner().productDescription(); + } + + @Override + public String productFamily() { + return this.inner().productFamily(); + } + + @Override + public String productType() { + return this.inner().productType(); + } + + @Override + public String productTypeId() { + return this.inner().productTypeId(); + } + + @Override + public Integer quantity() { + return this.inner().quantity(); + } + + @Override + public DateTime servicePeriodEndDate() { + return this.inner().servicePeriodEndDate(); + } + + @Override + public DateTime servicePeriodStartDate() { + return this.inner().servicePeriodStartDate(); + } + + @Override + public String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public String subscriptionName() { + return this.inner().subscriptionName(); + } + + @Override + public Amount subTotal() { + return this.inner().subTotal(); + } + + @Override + public Amount tax() { + return this.inner().tax(); + } + + @Override + public Amount transactionAmount() { + return this.inner().transactionAmount(); + } + + @Override + public ReservationType transactionType() { + return this.inner().transactionType(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String unitOfMeasure() { + return this.inner().unitOfMeasure(); + } + + @Override + public Double units() { + return this.inner().units(); + } + + @Override + public String unitType() { + return this.inner().unitType(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionInner.java new file mode 100644 index 0000000000000..2ec1541f5c411 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionInner.java @@ -0,0 +1,572 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.TransactionTypeKind; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ReservationType; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Amount; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A transaction. + */ +@JsonFlatten +public class TransactionInner extends ProxyResource { + /** + * The kind of transaction. Options are all or reservation. Possible values + * include: 'all', 'reservation'. + */ + @JsonProperty(value = "properties.kind") + private TransactionTypeKind kind; + + /** + * The date of transaction. + */ + @JsonProperty(value = "properties.date", access = JsonProperty.Access.WRITE_ONLY) + private DateTime dateProperty; + + /** + * Invoice on which the transaction was billed or 'pending' if the + * transaction is not billed. + */ + @JsonProperty(value = "properties.invoice", access = JsonProperty.Access.WRITE_ONLY) + private String invoice; + + /** + * The order ID of the reservation. The field is only applicable for + * transaction of kind reservation. + */ + @JsonProperty(value = "properties.orderId", access = JsonProperty.Access.WRITE_ONLY) + private String orderId; + + /** + * The name of the reservation order. The field is only applicable for + * transactions of kind reservation. + */ + @JsonProperty(value = "properties.orderName", access = JsonProperty.Access.WRITE_ONLY) + private String orderName; + + /** + * The family of the product for which the transaction took place. + */ + @JsonProperty(value = "properties.productFamily", access = JsonProperty.Access.WRITE_ONLY) + private String productFamily; + + /** + * The ID of the product type for which the transaction took place. + */ + @JsonProperty(value = "properties.productTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String productTypeId; + + /** + * The type of the product for which the transaction took place. + */ + @JsonProperty(value = "properties.productType", access = JsonProperty.Access.WRITE_ONLY) + private String productType; + + /** + * The description of the product for which the transaction took place. + */ + @JsonProperty(value = "properties.productDescription", access = JsonProperty.Access.WRITE_ONLY) + private String productDescription; + + /** + * The type of transaction. Possible values include: 'Purchase', 'Usage + * Charge'. + */ + @JsonProperty(value = "properties.transactionType") + private ReservationType transactionType; + + /** + * The charge associated with the transaction. + */ + @JsonProperty(value = "properties.transactionAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount transactionAmount; + + /** + * The quantity purchased in the transaction. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private Integer quantity; + + /** + * The ID of the invoice section which will be billed for the transaction. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * The name of the invoice section which will be billed for the + * transaction. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /** + * The ID of the billing profile which will be billed for the transaction. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The name of the billing profile which will be billed for the + * transaction. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /** + * The ID of the customer for which the transaction took place. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * The name of the customer for which the transaction took place. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + + /** + * The ID of the subscription that was used for the transaction. The field + * is only applicable for transaction of kind reservation. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * The name of the subscription that was used for the transaction. The + * field is only applicable for transaction of kind reservation. + */ + @JsonProperty(value = "properties.subscriptionName", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionName; + + /** + * The amount of any Azure credits automatically applied to this + * transaction. + */ + @JsonProperty(value = "properties.azureCreditApplied", access = JsonProperty.Access.WRITE_ONLY) + private Amount azureCreditApplied; + + /** + * The ISO 4217 code for the currency in which this transaction is billed. + */ + @JsonProperty(value = "properties.billingCurrency", access = JsonProperty.Access.WRITE_ONLY) + private String billingCurrency; + + /** + * The percentage discount, if any, applied to this transaction. + */ + @JsonProperty(value = "properties.discount", access = JsonProperty.Access.WRITE_ONLY) + private Double discount; + + /** + * The price of the product after applying any discounts. + */ + @JsonProperty(value = "properties.effectivePrice", access = JsonProperty.Access.WRITE_ONLY) + private Amount effectivePrice; + + /** + * The exchange rate used to convert charged amount to billing currency, if + * applicable. + */ + @JsonProperty(value = "properties.exchangeRate", access = JsonProperty.Access.WRITE_ONLY) + private Double exchangeRate; + + /** + * The retail price of the product. + */ + @JsonProperty(value = "properties.marketPrice", access = JsonProperty.Access.WRITE_ONLY) + private Amount marketPrice; + + /** + * The ISO 4217 code for the currency in which the product is priced. + */ + @JsonProperty(value = "properties.pricingCurrency", access = JsonProperty.Access.WRITE_ONLY) + private String pricingCurrency; + + /** + * The date of the purchase of the product, or the start date of the month + * in which usage started. + */ + @JsonProperty(value = "properties.servicePeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime servicePeriodStartDate; + + /** + * The end date of the product term, or the end date of the month in which + * usage ended. + */ + @JsonProperty(value = "properties.servicePeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime servicePeriodEndDate; + + /** + * The pre-tax charged amount for the transaction. + */ + @JsonProperty(value = "properties.subTotal", access = JsonProperty.Access.WRITE_ONLY) + private Amount subTotal; + + /** + * The tax amount applied to the transaction. + */ + @JsonProperty(value = "properties.tax", access = JsonProperty.Access.WRITE_ONLY) + private Amount tax; + + /** + * The unit of measure used to bill for the product. For example, compute + * services are billed per hour. + */ + @JsonProperty(value = "properties.unitOfMeasure", access = JsonProperty.Access.WRITE_ONLY) + private String unitOfMeasure; + + /** + * The number of units used for a given product. + */ + @JsonProperty(value = "properties.units", access = JsonProperty.Access.WRITE_ONLY) + private Double units; + + /** + * The description for the unit of measure for a given product. + */ + @JsonProperty(value = "properties.unitType", access = JsonProperty.Access.WRITE_ONLY) + private String unitType; + + /** + * Get the kind of transaction. Options are all or reservation. Possible values include: 'all', 'reservation'. + * + * @return the kind value + */ + public TransactionTypeKind kind() { + return this.kind; + } + + /** + * Set the kind of transaction. Options are all or reservation. Possible values include: 'all', 'reservation'. + * + * @param kind the kind value to set + * @return the TransactionInner object itself. + */ + public TransactionInner withKind(TransactionTypeKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the date of transaction. + * + * @return the dateProperty value + */ + public DateTime dateProperty() { + return this.dateProperty; + } + + /** + * Get invoice on which the transaction was billed or 'pending' if the transaction is not billed. + * + * @return the invoice value + */ + public String invoice() { + return this.invoice; + } + + /** + * Get the order ID of the reservation. The field is only applicable for transaction of kind reservation. + * + * @return the orderId value + */ + public String orderId() { + return this.orderId; + } + + /** + * Get the name of the reservation order. The field is only applicable for transactions of kind reservation. + * + * @return the orderName value + */ + public String orderName() { + return this.orderName; + } + + /** + * Get the family of the product for which the transaction took place. + * + * @return the productFamily value + */ + public String productFamily() { + return this.productFamily; + } + + /** + * Get the ID of the product type for which the transaction took place. + * + * @return the productTypeId value + */ + public String productTypeId() { + return this.productTypeId; + } + + /** + * Get the type of the product for which the transaction took place. + * + * @return the productType value + */ + public String productType() { + return this.productType; + } + + /** + * Get the description of the product for which the transaction took place. + * + * @return the productDescription value + */ + public String productDescription() { + return this.productDescription; + } + + /** + * Get the type of transaction. Possible values include: 'Purchase', 'Usage Charge'. + * + * @return the transactionType value + */ + public ReservationType transactionType() { + return this.transactionType; + } + + /** + * Set the type of transaction. Possible values include: 'Purchase', 'Usage Charge'. + * + * @param transactionType the transactionType value to set + * @return the TransactionInner object itself. + */ + public TransactionInner withTransactionType(ReservationType transactionType) { + this.transactionType = transactionType; + return this; + } + + /** + * Get the charge associated with the transaction. + * + * @return the transactionAmount value + */ + public Amount transactionAmount() { + return this.transactionAmount; + } + + /** + * Get the quantity purchased in the transaction. + * + * @return the quantity value + */ + public Integer quantity() { + return this.quantity; + } + + /** + * Get the ID of the invoice section which will be billed for the transaction. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the name of the invoice section which will be billed for the transaction. + * + * @return the invoiceSectionDisplayName value + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the ID of the billing profile which will be billed for the transaction. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the name of the billing profile which will be billed for the transaction. + * + * @return the billingProfileDisplayName value + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the ID of the customer for which the transaction took place. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the name of the customer for which the transaction took place. The field is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + + /** + * Get the ID of the subscription that was used for the transaction. The field is only applicable for transaction of kind reservation. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the name of the subscription that was used for the transaction. The field is only applicable for transaction of kind reservation. + * + * @return the subscriptionName value + */ + public String subscriptionName() { + return this.subscriptionName; + } + + /** + * Get the amount of any Azure credits automatically applied to this transaction. + * + * @return the azureCreditApplied value + */ + public Amount azureCreditApplied() { + return this.azureCreditApplied; + } + + /** + * Get the ISO 4217 code for the currency in which this transaction is billed. + * + * @return the billingCurrency value + */ + public String billingCurrency() { + return this.billingCurrency; + } + + /** + * Get the percentage discount, if any, applied to this transaction. + * + * @return the discount value + */ + public Double discount() { + return this.discount; + } + + /** + * Get the price of the product after applying any discounts. + * + * @return the effectivePrice value + */ + public Amount effectivePrice() { + return this.effectivePrice; + } + + /** + * Get the exchange rate used to convert charged amount to billing currency, if applicable. + * + * @return the exchangeRate value + */ + public Double exchangeRate() { + return this.exchangeRate; + } + + /** + * Get the retail price of the product. + * + * @return the marketPrice value + */ + public Amount marketPrice() { + return this.marketPrice; + } + + /** + * Get the ISO 4217 code for the currency in which the product is priced. + * + * @return the pricingCurrency value + */ + public String pricingCurrency() { + return this.pricingCurrency; + } + + /** + * Get the date of the purchase of the product, or the start date of the month in which usage started. + * + * @return the servicePeriodStartDate value + */ + public DateTime servicePeriodStartDate() { + return this.servicePeriodStartDate; + } + + /** + * Get the end date of the product term, or the end date of the month in which usage ended. + * + * @return the servicePeriodEndDate value + */ + public DateTime servicePeriodEndDate() { + return this.servicePeriodEndDate; + } + + /** + * Get the pre-tax charged amount for the transaction. + * + * @return the subTotal value + */ + public Amount subTotal() { + return this.subTotal; + } + + /** + * Get the tax amount applied to the transaction. + * + * @return the tax value + */ + public Amount tax() { + return this.tax; + } + + /** + * Get the unit of measure used to bill for the product. For example, compute services are billed per hour. + * + * @return the unitOfMeasure value + */ + public String unitOfMeasure() { + return this.unitOfMeasure; + } + + /** + * Get the number of units used for a given product. + * + * @return the units value + */ + public Double units() { + return this.units; + } + + /** + * Get the description for the unit of measure for a given product. + * + * @return the unitType value + */ + public String unitType() { + return this.unitType; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionListResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionListResultImpl.java new file mode 100644 index 0000000000000..56432436dd378 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionListResultImpl.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.TransactionListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class TransactionListResultImpl extends WrapperImpl implements TransactionListResult { + private final BillingManager manager; + TransactionListResultImpl(TransactionListResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionListResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionListResultInner.java new file mode 100644 index 0000000000000..5994d1e32f3e0 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionListResultInner.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of transactions. + */ +public class TransactionListResultInner { + /** + * The list of transactions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the list of transactions. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the link (url) to the next page of results. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionsImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionsImpl.java new file mode 100644 index 0000000000000..da6eb9c100819 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionsImpl.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Transactions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Transaction; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransactionListResult; + +class TransactionsImpl extends WrapperImpl implements Transactions { + private final BillingManager manager; + + TransactionsImpl(BillingManager manager) { + super(manager.inner().transactions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private TransactionImpl wrapModel(TransactionInner inner) { + return new TransactionImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + TransactionsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Transaction call(TransactionInner inner) { + return new TransactionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + TransactionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .map(new Func1() { + @Override + public TransactionListResult call(TransactionListResultInner inner) { + return new TransactionListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String periodStartDate, String periodEndDate) { + TransactionsInner client = this.inner(); + return client.listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, periodStartDate, periodEndDate) + .map(new Func1() { + @Override + public TransactionListResult call(TransactionListResultInner inner) { + return new TransactionListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceAsync(final String billingAccountName, final String billingProfileName, final String invoiceName) { + TransactionsInner client = this.inner(); + return client.listByInvoiceAsync(billingAccountName, billingProfileName, invoiceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Transaction call(TransactionInner inner) { + return new TransactionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName, String transactionName, String periodStartDate, String periodEndDate) { + TransactionsInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName, transactionName, periodStartDate, periodEndDate) + .map(new Func1() { + @Override + public Transaction call(TransactionInner inner) { + return new TransactionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByCustomerAsync(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate) { + TransactionsInner client = this.inner(); + return client.listByCustomerAsync(billingAccountName, customerName, periodStartDate, periodEndDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Transaction call(TransactionInner inner) { + return 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/TransactionsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionsInner.java new file mode 100644 index 0000000000000..a09b96bcef8b2 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransactionsInner.java @@ -0,0 +1,1587 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.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; + +/** + * An instance of this class provides access to all the operations defined + * in Transactions. + */ +public class TransactionsInner { + /** The Retrofit service to perform REST calls. */ + private TransactionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of TransactionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransactionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(TransactionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Transactions to be + * used by Retrofit to perform actually REST calls. + */ + interface TransactionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Transactions listByCustomer" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/transactions") + Observable> listByCustomer(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Transactions listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/transactions") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Transactions listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Transactions listByInvoiceSection" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transactions") + Observable> listByInvoiceSection(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Transactions listByInvoice" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}/transactions") + Observable> listByInvoice(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Transactions get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions/{transactionName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("transactionName") String transactionName, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @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.Transactions listByCustomerNext" }) + @GET + Observable> listByCustomerNext(@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.Transactions 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.Transactions listByInvoiceNext" }) + @GET + Observable> listByInvoiceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @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<TransactionInner> object if successful. + */ + public PagedList listByCustomer(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate) { + ServiceResponse> response = listByCustomerSinglePageAsync(billingAccountName, customerName, periodStartDate, periodEndDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @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> listByCustomerAsync(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerSinglePageAsync(billingAccountName, customerName, periodStartDate, periodEndDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable> listByCustomerAsync(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName, periodStartDate, periodEndDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable>> listByCustomerWithServiceResponseAsync(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate) { + return listByCustomerSinglePageAsync(billingAccountName, customerName, periodStartDate, periodEndDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerSinglePageAsync(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + final String filter = null; + return service.listByCustomer(billingAccountName, customerName, this.client.apiVersion(), periodStartDate, periodEndDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionInner> object if successful. + */ + public PagedList listByCustomer(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate, final String filter) { + ServiceResponse> response = listByCustomerSinglePageAsync(billingAccountName, customerName, periodStartDate, periodEndDate, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByCustomerAsync(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerSinglePageAsync(billingAccountName, customerName, periodStartDate, periodEndDate, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable> listByCustomerAsync(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate, final String filter) { + return listByCustomerWithServiceResponseAsync(billingAccountName, customerName, periodStartDate, periodEndDate, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable>> listByCustomerWithServiceResponseAsync(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate, final String filter) { + return listByCustomerSinglePageAsync(billingAccountName, customerName, periodStartDate, periodEndDate, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param customerName The ID that uniquely identifies a customer. + ServiceResponse> * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + ServiceResponse> * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + ServiceResponse> * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerSinglePageAsync(final String billingAccountName, final String customerName, final String periodStartDate, final String periodEndDate, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + return service.listByCustomer(billingAccountName, customerName, this.client.apiVersion(), periodStartDate, periodEndDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerDelegate(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 billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @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<TransactionInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @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 String periodStartDate, final String periodEndDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + return listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + final String filter = null; + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), periodStartDate, periodEndDate, filter, 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); + } + } + }); + } + + /** + * Lists the billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionInner> object if successful. + */ + public PagedList listByBillingAccount(final String billingAccountName, final String periodStartDate, final String periodEndDate, final String filter) { + ServiceResponse> response = listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable> listByBillingAccountAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate, final String filter) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable>> listByBillingAccountWithServiceResponseAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate, final String filter) { + return listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + ServiceResponse> * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + ServiceResponse> * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountSinglePageAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), periodStartDate, periodEndDate, filter, 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); + } + + /** + * Lists the billed and unbilled transactions by billing profile name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @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 TransactionListResultInner object if successful. + */ + public TransactionListResultInner listByBillingProfile(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).toBlocking().single().body(); + } + + /** + * Lists the billed and unbilled transactions by billing profile name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate), serviceCallback); + } + + /** + * Lists the billed and unbilled transactions by billing profile name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransactionListResultInner object + */ + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).map(new Func1, TransactionListResultInner>() { + @Override + public TransactionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billed and unbilled transactions by billing profile name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransactionListResultInner object + */ + public Observable> listByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + final String filter = null; + return service.listByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), periodStartDate, periodEndDate, filter, 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); + } + } + }); + } + + /** + * Lists the billed and unbilled transactions by billing profile name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TransactionListResultInner object if successful. + */ + public TransactionListResultInner listByBillingProfile(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate, String filter) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate, filter).toBlocking().single().body(); + } + + /** + * Lists the billed and unbilled transactions by billing profile name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate, filter), serviceCallback); + } + + /** + * Lists the billed and unbilled transactions by billing profile name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransactionListResultInner object + */ + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate, String filter) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate, filter).map(new Func1, TransactionListResultInner>() { + @Override + public TransactionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billed and unbilled transactions by billing profile name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransactionListResultInner object + */ + public Observable> listByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate, String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + return service.listByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), periodStartDate, periodEndDate, filter, 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); + } + + /** + * Lists the billed and unbilled transactions by invoice section name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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 periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @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 TransactionListResultInner object if successful. + */ + public TransactionListResultInner listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String periodStartDate, String periodEndDate) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, periodStartDate, periodEndDate).toBlocking().single().body(); + } + + /** + * Lists the billed and unbilled transactions by invoice section name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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 periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @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, String periodStartDate, String periodEndDate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, periodStartDate, periodEndDate), serviceCallback); + } + + /** + * Lists the billed and unbilled transactions by invoice section name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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 periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransactionListResultInner object + */ + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String periodStartDate, String periodEndDate) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, periodStartDate, periodEndDate).map(new Func1, TransactionListResultInner>() { + @Override + public TransactionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billed and unbilled transactions by invoice section name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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 periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransactionListResultInner object + */ + public Observable> listByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String periodStartDate, String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + final String filter = null; + return service.listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), periodStartDate, periodEndDate, filter, 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); + } + } + }); + } + + /** + * Lists the billed and unbilled transactions by invoice section name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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 periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TransactionListResultInner object if successful. + */ + public TransactionListResultInner listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String periodStartDate, String periodEndDate, String filter) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, periodStartDate, periodEndDate, filter).toBlocking().single().body(); + } + + /** + * Lists the billed and unbilled transactions by invoice section name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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 periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String periodStartDate, String periodEndDate, String filter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, periodStartDate, periodEndDate, filter), serviceCallback); + } + + /** + * Lists the billed and unbilled transactions by invoice section name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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 periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransactionListResultInner object + */ + public Observable listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String periodStartDate, String periodEndDate, String filter) { + return listByInvoiceSectionWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, periodStartDate, periodEndDate, filter).map(new Func1, TransactionListResultInner>() { + @Override + public TransactionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billed and unbilled transactions by invoice section name for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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 periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param filter May be used to filter by transaction type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransactionListResultInner object + */ + public Observable> listByInvoiceSectionWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String periodStartDate, String periodEndDate, String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + return service.listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, this.client.apiVersion(), periodStartDate, periodEndDate, filter, 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); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @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<TransactionInner> object if successful. + */ + public PagedList listByInvoice(final String billingAccountName, final String billingProfileName, final String invoiceName) { + ServiceResponse> response = listByInvoiceSinglePageAsync(billingAccountName, billingProfileName, invoiceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @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> listByInvoiceAsync(final String billingAccountName, final String billingProfileName, final String invoiceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSinglePageAsync(billingAccountName, billingProfileName, invoiceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable> listByInvoiceAsync(final String billingAccountName, final String billingProfileName, final String invoiceName) { + return listByInvoiceWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionInner> object + */ + public Observable>> listByInvoiceWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String invoiceName) { + return listByInvoiceSinglePageAsync(billingAccountName, billingProfileName, invoiceName) + .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(listByInvoiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSinglePageAsync(final String billingAccountName, final String billingProfileName, final String invoiceName) { + 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 (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInvoice(billingAccountName, billingProfileName, invoiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a transaction by ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param transactionName The ID that uniquely identifies a transaction. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @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 TransactionInner object if successful. + */ + public TransactionInner get(String billingAccountName, String billingProfileName, String transactionName, String periodStartDate, String periodEndDate) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, transactionName, periodStartDate, periodEndDate).toBlocking().single().body(); + } + + /** + * Gets a transaction by ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param transactionName The ID that uniquely identifies a transaction. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String billingProfileName, String transactionName, String periodStartDate, String periodEndDate, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, transactionName, periodStartDate, periodEndDate), serviceCallback); + } + + /** + * Gets a transaction by ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param transactionName The ID that uniquely identifies a transaction. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransactionInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String transactionName, String periodStartDate, String periodEndDate) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, transactionName, periodStartDate, periodEndDate).map(new Func1, TransactionInner>() { + @Override + public TransactionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a transaction by ID. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param transactionName The ID that uniquely identifies a transaction. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransactionInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName, String transactionName, String periodStartDate, String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (transactionName == null) { + throw new IllegalArgumentException("Parameter transactionName is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, billingProfileName, transactionName, periodStartDate, periodEndDate, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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<TransactionInner> object if successful. + */ + public PagedList listByCustomerNext(final String nextPageLink) { + ServiceResponse> response = listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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> listByCustomerNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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<TransactionInner> object + */ + public Observable> listByCustomerNextAsync(final String nextPageLink) { + return listByCustomerNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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<TransactionInner> object + */ + public Observable>> listByCustomerNextWithServiceResponseAsync(final String nextPageLink) { + return listByCustomerNextSinglePageAsync(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(listByCustomerNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the billed and unbilled transactions by customer id for given start date and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and do not include tax. Tax is added to the amount once an invoice is generated. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNextSinglePageAsync(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.listByCustomerNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerNextDelegate(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 billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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<TransactionInner> 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 billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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 billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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<TransactionInner> 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 billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + * @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<TransactionInner> 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 billed and unbilled transactions by billing account name for given start and end date. Transactions include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice ID and do not include tax. Tax is added to the amount once an invoice is generated. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionInner> 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 transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @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<TransactionInner> object if successful. + */ + public PagedList listByInvoiceNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @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> listByInvoiceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @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<TransactionInner> object + */ + public Observable> listByInvoiceNextAsync(final String nextPageLink) { + return listByInvoiceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @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<TransactionInner> object + */ + public Observable>> listByInvoiceNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceNextSinglePageAsync(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(listByInvoiceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceNextSinglePageAsync(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.listByInvoiceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceNextDelegate(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/TransferBillingSubscriptionResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransferBillingSubscriptionResultImpl.java new file mode 100644 index 0000000000000..e0ba3498ca08b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransferBillingSubscriptionResultImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.TransferBillingSubscriptionResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class TransferBillingSubscriptionResultImpl extends WrapperImpl implements TransferBillingSubscriptionResult { + private final BillingManager manager; + TransferBillingSubscriptionResultImpl(TransferBillingSubscriptionResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public String billingSubscriptionName() { + return this.inner().billingSubscriptionName(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransferBillingSubscriptionResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransferBillingSubscriptionResultInner.java new file mode 100644 index 0000000000000..8f557060651f9 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransferBillingSubscriptionResultInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Result of the transfer billing subscription operation. + */ +@JsonFlatten +public class TransferBillingSubscriptionResultInner { + /** + * The destination billing subscription id. + */ + @JsonProperty(value = "properties.billingSubscriptionName") + private String billingSubscriptionName; + + /** + * Get the destination billing subscription id. + * + * @return the billingSubscriptionName value + */ + public String billingSubscriptionName() { + return this.billingSubscriptionName; + } + + /** + * Set the destination billing subscription id. + * + * @param billingSubscriptionName the billingSubscriptionName value to set + * @return the TransferBillingSubscriptionResultInner object itself. + */ + public TransferBillingSubscriptionResultInner withBillingSubscriptionName(String billingSubscriptionName) { + this.billingSubscriptionName = billingSubscriptionName; + 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/TransferDetailsInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransferDetailsInner.java new file mode 100644 index 0000000000000..f9fe5c07ba7f1 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransferDetailsInner.java @@ -0,0 +1,240 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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 org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2019_10_01_preview.TransferStatus; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.DetailedTransferStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Details of the transfer. + */ +@JsonFlatten +public class TransferDetailsInner { + /** + * The time at which the transfer request was created. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationTime; + + /** + * The time at which the transfer request expires. + */ + @JsonProperty(value = "properties.expirationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expirationTime; + + /** + * The ID of the invoice section to which the product is billed after the + * transfer request is completed. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * The ID of the billing account to which the product is billed after the + * transfer request is completed. + */ + @JsonProperty(value = "properties.billingAccountId", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountId; + + /** + * Optional MPN ID of the reseller for transfer requests that are sent from + * a Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.resellerId", access = JsonProperty.Access.WRITE_ONLY) + private String resellerId; + + /** + * Optional name of the reseller for transfer requests that are sent from + * Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.resellerName", access = JsonProperty.Access.WRITE_ONLY) + private String resellerName; + + /** + * The type of customer who sent the transfer request. + */ + @JsonProperty(value = "properties.initiatorCustomerType", access = JsonProperty.Access.WRITE_ONLY) + private String initiatorCustomerType; + + /** + * The ID of the billing profile to which the product will be billed after + * the transfer. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * Overall transfer status. Possible values include: 'Pending', + * 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', 'Canceled', + * 'Declined'. + */ + @JsonProperty(value = "properties.transferStatus", access = JsonProperty.Access.WRITE_ONLY) + private TransferStatus transferStatus; + + /** + * The email ID of the user to whom the transfer request was sent. + */ + @JsonProperty(value = "properties.recipientEmailId", access = JsonProperty.Access.WRITE_ONLY) + private String recipientEmailId; + + /** + * The email ID of the user who sent the transfer request. + */ + @JsonProperty(value = "properties.initiatorEmailId", access = JsonProperty.Access.WRITE_ONLY) + private String initiatorEmailId; + + /** + * The email ID of the user who canceled the transfer request. + */ + @JsonProperty(value = "properties.canceledBy", access = JsonProperty.Access.WRITE_ONLY) + private String canceledBy; + + /** + * The time at which the transfer request was last modified. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastModifiedTime; + + /** + * Detailed transfer status. + */ + @JsonProperty(value = "properties.detailedTransferStatus", access = JsonProperty.Access.WRITE_ONLY) + private List detailedTransferStatus; + + /** + * Get the time at which the transfer request was created. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + + /** + * Get the time at which the transfer request expires. + * + * @return the expirationTime value + */ + public DateTime expirationTime() { + return this.expirationTime; + } + + /** + * Get the ID of the invoice section to which the product is billed after the transfer request is completed. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the ID of the billing account to which the product is billed after the transfer request is completed. + * + * @return the billingAccountId value + */ + public String billingAccountId() { + return this.billingAccountId; + } + + /** + * Get optional MPN ID of the reseller for transfer requests that are sent from a Microsoft Partner Agreement billing account. + * + * @return the resellerId value + */ + public String resellerId() { + return this.resellerId; + } + + /** + * Get optional name of the reseller for transfer requests that are sent from Microsoft Partner Agreement billing account. + * + * @return the resellerName value + */ + public String resellerName() { + return this.resellerName; + } + + /** + * Get the type of customer who sent the transfer request. + * + * @return the initiatorCustomerType value + */ + public String initiatorCustomerType() { + return this.initiatorCustomerType; + } + + /** + * Get the ID of the billing profile to which the product will be billed after the transfer. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get overall transfer status. Possible values include: 'Pending', 'InProgress', 'Completed', 'CompletedWithErrors', 'Failed', 'Canceled', 'Declined'. + * + * @return the transferStatus value + */ + public TransferStatus transferStatus() { + return this.transferStatus; + } + + /** + * Get the email ID of the user to whom the transfer request was sent. + * + * @return the recipientEmailId value + */ + public String recipientEmailId() { + return this.recipientEmailId; + } + + /** + * Get the email ID of the user who sent the transfer request. + * + * @return the initiatorEmailId value + */ + public String initiatorEmailId() { + return this.initiatorEmailId; + } + + /** + * Get the email ID of the user who canceled the transfer request. + * + * @return the canceledBy value + */ + public String canceledBy() { + return this.canceledBy; + } + + /** + * Get the time at which the transfer request was last modified. + * + * @return the lastModifiedTime value + */ + public DateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get detailed transfer status. + * + * @return the detailedTransferStatus value + */ + public List detailedTransferStatus() { + return this.detailedTransferStatus; + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransfersImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransfersImpl.java new file mode 100644 index 0000000000000..c4fe950b111d9 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransfersImpl.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.Transfers; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InvoiceSectionBillingProfileBillingAccountTransferDetails; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InitiateTransferRequest; + +class TransfersImpl extends WrapperImpl implements Transfers { + private final BillingManager manager; + + TransfersImpl(BillingManager manager) { + super(manager.inner().transfers()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private InvoiceSectionBillingProfileBillingAccountTransferDetailsImpl wrapModel(TransferDetailsInner inner) { + return new InvoiceSectionBillingProfileBillingAccountTransferDetailsImpl(inner, manager()); + } + + @Override + public Observable listAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + TransfersInner client = this.inner(); + return client.listAsync(billingAccountName, billingProfileName, invoiceSectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InvoiceSectionBillingProfileBillingAccountTransferDetails call(TransferDetailsInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName) { + TransfersInner client = this.inner(); + return client.getAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName) + .flatMap(new Func1>() { + @Override + public Observable call(TransferDetailsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((InvoiceSectionBillingProfileBillingAccountTransferDetails)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable cancelAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName) { + TransfersInner client = this.inner(); + return client.cancelAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName).toCompletable(); + } + + @Override + public Observable initiateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, InitiateTransferRequest parameters) { + TransfersInner client = this.inner(); + return client.initiateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters) + .map(new Func1() { + @Override + public InvoiceSectionBillingProfileBillingAccountTransferDetails call(TransferDetailsInner inner) { + return new InvoiceSectionBillingProfileBillingAccountTransferDetailsImpl(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/TransfersInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransfersInner.java new file mode 100644 index 0000000000000..926ede58fcc18 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/TransfersInner.java @@ -0,0 +1,605 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2019_10_01_preview.InitiateTransferRequest; +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; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Transfers. + */ +public class TransfersInner { + /** The Retrofit service to perform REST calls. */ + private TransfersService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of TransfersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransfersInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(TransfersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Transfers to be + * used by Retrofit to perform actually REST calls. + */ + interface TransfersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Transfers initiate" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/initiateTransfer") + Observable> initiate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Body InitiateTransferRequest 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.Transfers get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("transferName") String transferName, @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.Transfers cancel" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}", method = "DELETE", hasBody = true) + Observable> cancel(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Path("transferName") String transferName, @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.Transfers list" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers") + Observable> list(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceSectionName") String invoiceSectionName, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2019_10_01_preview.Transfers listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Sends a request to a user in another billing account to transfer billing ownership of their subscriptions. The operation is supported only 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 initiate transfer 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 TransferDetailsInner object if successful. + */ + public TransferDetailsInner initiate(String billingAccountName, String billingProfileName, String invoiceSectionName, InitiateTransferRequest parameters) { + return initiateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).toBlocking().single().body(); + } + + /** + * Sends a request to a user in another billing account to transfer billing ownership of their subscriptions. The operation is supported only 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 initiate transfer 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 initiateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, InitiateTransferRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(initiateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters), serviceCallback); + } + + /** + * Sends a request to a user in another billing account to transfer billing ownership of their subscriptions. The operation is supported only 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 initiate transfer operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable initiateAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, InitiateTransferRequest parameters) { + return initiateWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).map(new Func1, TransferDetailsInner>() { + @Override + public TransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Sends a request to a user in another billing account to transfer billing ownership of their subscriptions. The operation is supported only 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 initiate transfer operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable> initiateWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, InitiateTransferRequest 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.initiate(billingAccountName, billingProfileName, invoiceSectionName, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = initiateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse initiateDelegate(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 a transfer request by ID. The operation is supported only 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 transferName The ID that uniquely identifies a transfer request. + * @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 TransferDetailsInner object if successful. + */ + public TransferDetailsInner get(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName).toBlocking().single().body(); + } + + /** + * Gets a transfer request by ID. The operation is supported only 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 transferName The ID that uniquely identifies a transfer request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName), serviceCallback); + } + + /** + * Gets a transfer request by ID. The operation is supported only 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 transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName).map(new Func1, TransferDetailsInner>() { + @Override + public TransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a transfer request by ID. The operation is supported only 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 transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName) { + 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 (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + return service.get(billingAccountName, billingProfileName, invoiceSectionName, transferName, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Cancels a transfer request. The operation is supported only 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 transferName The ID that uniquely identifies a transfer request. + * @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 TransferDetailsInner object if successful. + */ + public TransferDetailsInner cancel(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName) { + return cancelWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName).toBlocking().single().body(); + } + + /** + * Cancels a transfer request. The operation is supported only 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 transferName The ID that uniquely identifies a transfer request. + * @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 cancelAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName), serviceCallback); + } + + /** + * Cancels a transfer request. The operation is supported only 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 transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable cancelAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName) { + return cancelWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName).map(new Func1, TransferDetailsInner>() { + @Override + public TransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels a transfer request. The operation is supported only 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 transferName The ID that uniquely identifies a transfer request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable> cancelWithServiceResponseAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName) { + 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 (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + return service.cancel(billingAccountName, billingProfileName, invoiceSectionName, transferName, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = cancelDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse cancelDelegate(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 transfer requests for an invoice section. The operation is supported only 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 PagedList<TransferDetailsInner> object if successful. + */ + public PagedList list(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + ServiceResponse> response = listSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transfer requests for an invoice section. The operation is supported only 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> listAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transfer requests for an invoice section. The operation is supported only 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 PagedList<TransferDetailsInner> object + */ + public Observable> listAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceSectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transfer requests for an invoice section. The operation is supported only 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 PagedList<TransferDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String invoiceSectionName) { + return listSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transfer requests for an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + ServiceResponse> * @param billingAccountName The ID that uniquely identifies a billing account. + ServiceResponse> * @param billingProfileName The ID that uniquely identifies a billing profile. + ServiceResponse> * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransferDetailsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String billingAccountName, final String billingProfileName, final 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."); + } + return service.list(billingAccountName, billingProfileName, invoiceSectionName, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transfer requests for an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<TransferDetailsInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transfer requests for an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer 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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transfer requests for an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<TransferDetailsInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transfer requests for an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<TransferDetailsInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transfer requests for an invoice section. The operation is supported only for billing accounts with agreement type Microsoft Customer 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<TransferDetailsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/UpdateAutoRenewOperationImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/UpdateAutoRenewOperationImpl.java new file mode 100644 index 0000000000000..933521359f67a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/UpdateAutoRenewOperationImpl.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.UpdateAutoRenewOperation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; + +class UpdateAutoRenewOperationImpl extends WrapperImpl implements UpdateAutoRenewOperation { + private final BillingManager manager; + UpdateAutoRenewOperationImpl(UpdateAutoRenewOperationInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/UpdateAutoRenewOperationInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/UpdateAutoRenewOperationInner.java new file mode 100644 index 0000000000000..fe540eb6df842 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/UpdateAutoRenewOperationInner.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Result of the update auto renew operation. + */ +@JsonFlatten +public class UpdateAutoRenewOperationInner { + /** + * The date at which the product will be canceled. + */ + @JsonProperty(value = "properties.endDate") + private DateTime endDate; + + /** + * Get the date at which the product will be canceled. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set the date at which the product will be canceled. + * + * @param endDate the endDate value to set + * @return the UpdateAutoRenewOperationInner object itself. + */ + public UpdateAutoRenewOperationInner withEndDate(DateTime endDate) { + this.endDate = endDate; + 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/ValidateAddressResponseImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateAddressResponseImpl.java new file mode 100644 index 0000000000000..e286e36b124e8 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateAddressResponseImpl.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.ValidateAddressResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AddressValidationStatus; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AddressDetails; + +class ValidateAddressResponseImpl extends WrapperImpl implements ValidateAddressResponse { + private final BillingManager manager; + ValidateAddressResponseImpl(ValidateAddressResponseInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public AddressValidationStatus status() { + return this.inner().status(); + } + + @Override + public List suggestedAddresses() { + return this.inner().suggestedAddresses(); + } + + @Override + public String validationMessage() { + return this.inner().validationMessage(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateAddressResponseInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateAddressResponseInner.java new file mode 100644 index 0000000000000..04f9afe72bb52 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateAddressResponseInner.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.AddressValidationStatus; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.AddressDetails; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the address validation. + */ +public class ValidateAddressResponseInner { + /** + * status of the address validation. Possible values include: 'Valid', + * 'Invalid'. + */ + @JsonProperty(value = "status") + private AddressValidationStatus status; + + /** + * The list of suggested addresses. + */ + @JsonProperty(value = "suggestedAddresses") + private List suggestedAddresses; + + /** + * Validation error message. + */ + @JsonProperty(value = "validationMessage") + private String validationMessage; + + /** + * Get status of the address validation. Possible values include: 'Valid', 'Invalid'. + * + * @return the status value + */ + public AddressValidationStatus status() { + return this.status; + } + + /** + * Set status of the address validation. Possible values include: 'Valid', 'Invalid'. + * + * @param status the status value to set + * @return the ValidateAddressResponseInner object itself. + */ + public ValidateAddressResponseInner withStatus(AddressValidationStatus status) { + this.status = status; + return this; + } + + /** + * Get the list of suggested addresses. + * + * @return the suggestedAddresses value + */ + public List suggestedAddresses() { + return this.suggestedAddresses; + } + + /** + * Set the list of suggested addresses. + * + * @param suggestedAddresses the suggestedAddresses value to set + * @return the ValidateAddressResponseInner object itself. + */ + public ValidateAddressResponseInner withSuggestedAddresses(List suggestedAddresses) { + this.suggestedAddresses = suggestedAddresses; + return this; + } + + /** + * Get validation error message. + * + * @return the validationMessage value + */ + public String validationMessage() { + return this.validationMessage; + } + + /** + * Set validation error message. + * + * @param validationMessage the validationMessage value to set + * @return the ValidateAddressResponseInner object itself. + */ + public ValidateAddressResponseInner withValidationMessage(String validationMessage) { + this.validationMessage = validationMessage; + 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/ValidateProductTransferEligibilityResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateProductTransferEligibilityResultImpl.java new file mode 100644 index 0000000000000..2f349a06f39a3 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateProductTransferEligibilityResultImpl.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.ValidateProductTransferEligibilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ValidateProductTransferEligibilityError; + +class ValidateProductTransferEligibilityResultImpl extends WrapperImpl implements ValidateProductTransferEligibilityResult { + private final BillingManager manager; + ValidateProductTransferEligibilityResultImpl(ValidateProductTransferEligibilityResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public ValidateProductTransferEligibilityError errorDetails() { + return this.inner().errorDetails(); + } + + @Override + public Boolean isTransferEligible() { + return this.inner().isTransferEligible(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateProductTransferEligibilityResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateProductTransferEligibilityResultInner.java new file mode 100644 index 0000000000000..6b0a0f2a4750b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateProductTransferEligibilityResultInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.ValidateProductTransferEligibilityError; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the product transfer eligibility validation. + */ +public class ValidateProductTransferEligibilityResultInner { + /** + * Specifies whether the transfer is eligible or not. + */ + @JsonProperty(value = "isTransferEligible", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isTransferEligible; + + /** + * Validation error details. + */ + @JsonProperty(value = "errorDetails") + private ValidateProductTransferEligibilityError errorDetails; + + /** + * Get specifies whether the transfer is eligible or not. + * + * @return the isTransferEligible value + */ + public Boolean isTransferEligible() { + return this.isTransferEligible; + } + + /** + * Get validation error details. + * + * @return the errorDetails value + */ + public ValidateProductTransferEligibilityError errorDetails() { + return this.errorDetails; + } + + /** + * Set validation error details. + * + * @param errorDetails the errorDetails value to set + * @return the ValidateProductTransferEligibilityResultInner object itself. + */ + public ValidateProductTransferEligibilityResultInner withErrorDetails(ValidateProductTransferEligibilityError errorDetails) { + this.errorDetails = errorDetails; + 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/ValidateSubscriptionTransferEligibilityResultImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultImpl.java new file mode 100644 index 0000000000000..879c544c292c0 --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultImpl.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.ValidateSubscriptionTransferEligibilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ValidateSubscriptionTransferEligibilityError; + +class ValidateSubscriptionTransferEligibilityResultImpl extends WrapperImpl implements ValidateSubscriptionTransferEligibilityResult { + private final BillingManager manager; + ValidateSubscriptionTransferEligibilityResultImpl(ValidateSubscriptionTransferEligibilityResultInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public ValidateSubscriptionTransferEligibilityError errorDetails() { + return this.inner().errorDetails(); + } + + @Override + public Boolean isTransferEligible() { + return this.inner().isTransferEligible(); + } + +} diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultInner.java new file mode 100644 index 0000000000000..43ecfa8729ead --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultInner.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2019_10_01_preview.ValidateSubscriptionTransferEligibilityError; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the transfer eligibility validation. + */ +public class ValidateSubscriptionTransferEligibilityResultInner { + /** + * Specifies whether the subscription is eligible to be transferred. + */ + @JsonProperty(value = "isTransferEligible", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isTransferEligible; + + /** + * Validation error details. + */ + @JsonProperty(value = "errorDetails") + private ValidateSubscriptionTransferEligibilityError errorDetails; + + /** + * Get specifies whether the subscription is eligible to be transferred. + * + * @return the isTransferEligible value + */ + public Boolean isTransferEligible() { + return this.isTransferEligible; + } + + /** + * Get validation error details. + * + * @return the errorDetails value + */ + public ValidateSubscriptionTransferEligibilityError errorDetails() { + return this.errorDetails; + } + + /** + * Set validation error details. + * + * @param errorDetails the errorDetails value to set + * @return the ValidateSubscriptionTransferEligibilityResultInner object itself. + */ + public ValidateSubscriptionTransferEligibilityResultInner withErrorDetails(ValidateSubscriptionTransferEligibilityError errorDetails) { + this.errorDetails = errorDetails; + 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/ValidateTransferListResponseImpl.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateTransferListResponseImpl.java new file mode 100644 index 0000000000000..8e7e936954b6a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateTransferListResponseImpl.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.ValidateTransferListResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.billing.v2019_10_01_preview.ValidateTransferResponse; + +class ValidateTransferListResponseImpl extends WrapperImpl implements ValidateTransferListResponse { + private final BillingManager manager; + ValidateTransferListResponseImpl(ValidateTransferListResponseInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + 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/ValidateTransferListResponseInner.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateTransferListResponseInner.java new file mode 100644 index 0000000000000..69db46979c09b --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/ValidateTransferListResponseInner.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.microsoft.azure.management.billing.v2019_10_01_preview.ValidateTransferResponse; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of transfer validation. + */ +public class ValidateTransferListResponseInner { + /** + * The list of transfer validation results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the list of transfer validation results. + * + * @return the value 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/package-info.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..397658ef927aa --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for BillingManagementClient. + * Billing client provides access to billing resources for Azure subscriptions. + */ +package com.microsoft.azure.management.billing.v2019_10_01_preview.implementation; diff --git a/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/package-info.java b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/package-info.java new file mode 100644 index 0000000000000..62b83a45f744a --- /dev/null +++ b/sdk/billing/mgmt-v2019_10_01_preview/src/main/java/com/microsoft/azure/management/billing/v2019_10_01_preview/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for BillingManagementClient. + * Billing client provides access to billing resources for Azure subscriptions. + */ +package com.microsoft.azure.management.billing.v2019_10_01_preview;